"Jim Heavey" <an*******@discussions.microsoft.com> wrote in message news:AD**********************************@microsof t.com...
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