Session End Guarantee?

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
 
M

Mark Rae

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.
 
B

bruce barker

No. it only fires for inproc sessions, and if there is no recycle (which
force a kill process).

-- bruce (sqlwork.com)
 
D

David Lozzi

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
 
J

Juan T. Llibre

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.
 
M

Mark Rae

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... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top