Automatically redirect User after some interval in ASP.Net

Last Reply one year ago By AnandM

Posted one year ago

Hi this is siddu

I want to stop the auto refresh when there 

is   key press and mouse click event in withj C#

i used link

but not work for me pleasem let us know

The solution

       <meta http-equiv="refresh" content="60" />
<script type="text/javascript">
    var time = new Date().getTime();
    $(document.body).bind("mousemove keypress", function (e) {
        time = new Date().getTime();

    function refresh() {
        if (new Date().getTime() - time >= 60000)
            setTimeout(refresh, 10000);

    setTimeout(refresh, 10000);


  if (Session["user"] != null && Session["test"] != null)
            // let them access the page.

            Label1.Text = "Welcome " + Session["test"].ToString();
            //clear the cache and  redirect back to login page.


Posted one year ago

Hi siddu,

Can you explain in more detail exactly what you are trying to achieve if possible explain with an example

Posted one year ago

Hi Annad

I am doing

as when user after login if he idle for 1 min it should re direct to 

again login Page. if user after login he is doing  filling the form  details

which he redirectd , i want to stop the auto refresh after 1 min

if he  doing some thing

otherwise page will move to auto refresh and redirect to login page


I agree, here is the link: