View Single Post
  #5 (permalink)  
Old April 12th, 2007, 10:22 AM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

Ok. Here is your crash course in Session State.

For my example I will use your example of a session that lasts 30mins.

When I first enter a web application my session begins and the clock starts counting down. Now if I make another request to the application *that has to go to the server for processing (another asp page)* my session timeout will be reset again to 30mins.

Now, If i stay on one page and do nothing for 35 mins and then try to request a page that needs session variables or something of that sort, they will not be available as my session has timed out and the session object destoryed. As Peter suggested, using Javascript is the most effecient way to detect when X amount of time has elapsed on a particular page.

All you need to do is:

setTimeout(location.href='timeout.asp', 3000000)

After 30 mins has elapsed, the javascript location.href will be called and it will send your user to another page letting them know that their session has timed out.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========