Last post Mar 09, 2012 07:35 AM by DMW
Mar 09, 2012 05:23 AM|swasim186|LINK
how to detect session end
when browser window close by a user
Mar 09, 2012 06:46 AM|Ken Tucker|LINK
In the global.asax there is a session end event
Mar 09, 2012 07:35 AM|DMW|LINK
session end event
Except, this event is pretty unreliable at best. And it certainly won't be fired when the user closes their browser window.
If you read
and other similar posts, you will realise that detecting browser window close, and thereby closing down the session is a fairly difficult thing to achieve across all user agents and with utmost reliability. So feel free to have a go, but accept one thing:
you cannot guarantee that a user won't do something that skips around your mechanism.
Of course, the thing that is ultimately important is that you set appropriate timeouts for Session (and additionally for Authentication Tickets), so that if the user does neglect to sign out, or if their browser simply crashes (hmm, a browser crash? Surely
that never happens!), then the session (or ticket) will be shut down sensibly.