I am trying to get a list of active session id’s in my web application.
I tried to manage a list in Global.asax.
I add session id when Session_Start is fired, and remove session id when Session_End is fired.
The problem is in cases when the user closes the browser or shut down the computer.
The Session_End is not fired, and the seesion still exists in the list.
Somebody has an idea how can I get the list?
Thanks!
There is no solution to this problem that avoids the complication you note. Unless there is some explicit way to end a user’s session – and the user activates it – the only way to know when a session has ended is to allow it to expire.
Session_Endwill eventually fire, when the session times out. The only time you never seeSession_Endcalled is when the application domain itself unexpectedly quits. In such a case, you know that all of your sessions are dead, anyway.