-
Session End Event
Hi all,
I'm a bit weak in ASP.NET. Hence I need some help in this. how to fire the session_end event when the browser is closed so that i can write some cleanup code like formauthentication.signout etc.,
Hope u all understood wot i want.. though i am brief and little unclear in the explanation.
-
Re: Session End Event
No events are triggered when the browser is closed. HTTP is a stateless protocol so you will never know when the browser is gone.
If you have stored data in your Session, you can use the Session_End event in global.asax yourself.
Or alternatively, when users are browsing the site you could check if Session("authenticated") = True, and if not, or its equal to vbNullString, then they're either not authenticated or their Session variable has timed out and was automatically removed.
-
Re: Session End Event
I have heard of it working, but only spotty at best. But as plenderj said, the browser really doesn't have to report back. What if it crashes? Don't ever count on this event to work right when the browser closes. Count on it firing after the session times out instead.