Session TimeOut

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?
 
K

Ken Cox [Microsoft MVP]

The usual way to kill a session is Session.Abandon. Is that what you meant?
 
G

Guest

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
 
H

Hans Kesting

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top