I have an application that allows users to login and logout. I track how
many users are logged in and when each individual is logged in. The
application will not allow concurrent logins(let a user log in twice at the
same time). My problem is I am having trouble telling when the user is
logged off. If they click the logout button everything works fine. But if
the close the browser by clicking the x or navigate to another url through
the address bar I will get no indication that they have logged off. To
remedy that I placed the code to logoff the user in the Session_End method
of the Global.asax page. But there is a problem with this as well. I need
the user ID to perform the logoff tasks. I can't get this from a session
object because by the time the Session_End method is reached the session
object I previously created is destroyed. I tried using a public variable to
hold the user ID but I can not get access to it in the global.asax. I also
tried to place the user ID in a public shared variable, but this causes the
user ID to be overwritten whenever a new user logs in. Is there any way to
create a public variable that I can access from the global.asax page that is
not shared among application instances? Should I be looking at this from
another angle? Any ideas or help would be greatly appreciated.