Auto Refresh Web page every 5 minutes ASP.NET?

  • Thread starter Thread starter beerbsh316
  • Start date Start date
B

beerbsh316

Guest
I am developing a web page using Visual Studio 2003. I would like the page to auto refresh every 5 minutes as long as the user has not done anything on the page. For example when the user clicks a button on the page I would like to reset the time until an automatic refresh back to 5 minutes. I have looked at AJAX but I believe VS2003 is ASP.NET 1.1 and that is not supported by AJAX. Any suggestions would be appreciated.

Thanks
 
Add your own javascript that does this. I like jQuery because it plays with ASP.Net very nicely, but regular javascript will work too.

Add some javascripts when the page loads that sets a variable to a date/time 5 minutes in the future and a setTimeout() function with a granularity of one second to a function that checks the current time versus the variable -- if the current time exceeds the variable, window.reload(), if not, have it setTimeout() itself again for another 1 second.

Then use OnClientClick events with ASP.Net controls to update that variable anytime a control is used (activity) by changing it to the current time + 5 minutes again (resetting the page's expiration).
 
Back
Top