Session End Guarantee?

  • Thread starter Thread starter David Lozzi
  • Start date Start date
D

David Lozzi

Howdy,

is the Session_End event a guarantee event to be fired? I have this memory
of back in ASP and IIS 4 that the event was guaranteed, like a 50/50 chance.
If I have some shopping cart clean up functions in the Session_End event,
will that fire every single time a user's session expires whether from
closing the browser window, browsing to another site or programatically
abandoning a session? Or is there a better way?

Thanks,

Merry Christmas
David Lozzi
 
is the Session_End event a guarantee event to be fired?

Yes, unless you're using SQL Server for your session management.
If I have some shopping cart clean up functions in the Session_End event,
will that fire every single time a user's session expires whether from
closing the browser window, browsing to another site or programatically
abandoning a session?

Closing the browser window, or browsing to another site will NOT cause
Session_End to fire, at least, not straightaway - the server has absolutely
no way of knowing what happens on the client machine until it gets another
HttpRequest from it. In this instance, Session_End will fire when the
session times out naturally.
 
No. it only fires for inproc sessions, and if there is no recycle (which
force a kill process).

-- bruce (sqlwork.com)
 
OK, So I'm not using SQL for the session state, instead just inproc. So
after 20 minutes it'll expire and fire the event?

Thanks,
David Lozzi
 
re:
after 20 minutes it'll expire and fire the event?

If you have 20 minutes set as your session timeout, yes, if the ASP.NET
application hasn't been restarted by automatic app recycling.

If the app has been recycled, Session_End will not fire.
The app will simply be shut down and be restarted.

Otherwise, at the end of whatever number of minutes you have set for the timeout.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
 
OK, So I'm not using SQL for the session state, instead just inproc. So
after 20 minutes it'll expire and fire the event?

Yes, assuming:

1) that the default Session.Timeout of 20 minutes has not been changed.

2) that your app hasn't been recycled

3) obviously, that your server hasn't crashed or been subject to some other
unplanned shutdown... :-)
 
Back
Top