Session TimeOut

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am wanting to find out a way to timeout my session
This issue is that the user retrieve data from a datatable and that data get stale over time, so after 20 minutes, I want to be able to tell the user that their session has timed out and they will need to refresh their data

I set the session time out in the web config file to 20 minutes, but this does not seems to have no effect. The user is still able to retrieve data and leave that data on the screen for hours and then provide an update to that data

How do I cause a session timeout? Do I just create a session variable and check for it presense everytime and if it is not present, then I know I have a time out?
 
The usual way to kill a session is Session.Abandon. Is that what you meant?
 
Why not use the built in Cache Object. Read the "Caching Application Data" topic from MSDN (ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcacheapis.htm).

This also has a callback through the CacheItemRemovedCallback Delegate so that you can recreate the data. Remember that this is shared across application and you should create your own logic for each user. Quite simple

On the other hand if you still prefer to use the Session Object then you need to provide more informaiton as to the Events where the Data is being recreated and populated

Regards

Trevor Benedict R
 
Jim Heavey said:
I am wanting to find out a way to timeout my session.
This issue is that the user retrieve data from a datatable and that data get stale over time, so after 20 minutes, I want to be
able to tell the user that their session has timed out and they will need to refresh their data.
I set the session time out in the web config file to 20 minutes, but this does not seems to have no effect. The user is still
able to retrieve data and leave that data on the screen for hours and then provide an update to that data.
How do I cause a session timeout? Do I just create a session variable and check for it presense everytime and if it is not
present, then I know I have a time out?

"session timeout" is a server-side thing. When a response has been given (a page
has been sent to the browser), then the server is done with it and can't change it.
When the (server side) session times out, all session variables are removed for
this particular session, freeing resources.
By the way, the timeout is reset on every request so it is not 20 minutes after the
first request but after the latest request.

When you want to do something about reacting to stale data, you could do this:
a) check the session, if it is new (specific stored items are missing) then a timeout
has occurred. Forget the posted data and show an error message.
b) use a meta-refresh tag to redirect (client-side) to some other page after a timeout.

Hans Kesting
 
Back
Top