Session End Event?

admin

Administrator
Staff member
when does the session end event fire?

I thought the web was stateless and we couldn't accurately discern when a session ends (unless we call the event from say, a close button or something). Does the event ever fire by itself (the Session_End in global.asax.cs?) or does it have to be called.

If it is never called, when's a good time to write my session / click info im storing in classes?

mcmSession state by default has a 20 minutes timeout, which can be modified through the machine.config or the web.config. You can also force a session to end by using session.abandon. If either of these occur, then the session_end event is fired and yes it is fired by itself. If a user closes their browser before the session expires, then the session will remain in memory until the session expires, at which point the session_end event will fire.

If you would like to perform some functions when the session ends, then the session_end event method would be the place to do it.
 
Back
Top