Session_end, User Identity and resource cleanup

D

Dan Walls

Hi,

I am looking to clean up some database locks whenever a user session ends. A
user session ends whenever they:

a. shut down the browser and the session times out after 20 mins (20 mins is
the default)
b. they click logout button and I call session.abandon()

However a user session ID can be the same over multiple sessions if it is in
the same browser instance apparently.

How can I get user identity information in the session_end routine - as the
HttpContext object is not available there. Neither is the Response object.

Or alternatively - is there some serverside event that occurs when a user
authentication expires or is logged out by a formsauthentication.signout --
I guess I could free the resources there...

Thanks,
Dan.
 
M

Martin Dechev

Hi, Dan,

In the Session_End event handler you can still read from the Session
collection - just store the ID of the user inside it when the user signs in.

Hope this helps
Martin
 
A

Alvin Bruney [MVP]

In the Session_End event handler you can still read from the Session
collection - just store the ID of the user inside it when the user signs
in.

No, this isn't guaranteed to work. Abandon is responsible for tearing down
the session object before the session end event fires. You aren't guaranteed
valid results using this approach.
 

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

Similar Threads

Session_End() 1
Session_End 3
Session_End 4
Session_End 14
global.aspx and session_end event 8
Session_Start/Session_End 3
Tracking user logins with Session_End or other 3
Testing if session_end fires 0

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top