Session_End()

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
 
K

Kevin Spencer

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.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top