Session_End()

  • Thread starter Thread starter Timo
  • Start date Start date
T

Timo

A few questions relating to sessions ending.

1. What happens to the session when a user closes the browser? Does the
session remain alive until it times out?

2. In the Session_End eventhandler, is it possible to distinguish between a
timeout and an explicit call to Session.Abandon (e.g. from a logout page)
without setting a session variable in the code that invokes Session.Abandon?

3. In the Session_End event, what is the
System.Web.SessionState.SessionOnEndTarget passed in the 'sender' argument?
Does the EventArgs parameter ever contain useful information?

Thanks
Timo
 
1. What happens to the session when a user closes the browser? Does the
session remain alive until it times out?

Yes. The server has no way of knowing what is happening on the client. It
can only receive requests. When it doesn't receive any requests after the
timeout interval, it kills the Session.
2. In the Session_End eventhandler, is it possible to distinguish between
a
timeout and an explicit call to Session.Abandon (e.g. from a logout page)
without setting a session variable in the code that invokes
Session.Abandon?

If you set an Application-scoped variable prior to calling Session.Abandon,
it is certainly possible, by checking the value of the Application variable.
Of course, you have to distinguish in Application between different Sessions
somehow.
3. In the Session_End event, what is the
System.Web.SessionState.SessionOnEndTarget passed in the 'sender'
argument?
Does the EventArgs parameter ever contain useful information?

Not that I'm aware of.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Back
Top