Alright, I know that everyone here has probably wrestled with this at somepoint --> Ensuring Logout on Actual logout, session expiry, and browser close.
I have a site that will only allow 1 person to log in with a given username at one time. When someone logs in I change a field in the DB to hold the fact that they are logged in. If they actually log out then I am fine, the DB gets updated. However, the problem lies in if they timeout or close the browser.
I know that the session information is gone before we hit the Session_OnEnd event, which supposedly fires on browser close and session timeout so I can't use that information to ensure that I update my table appropriately.
Has anyone else had to handle this? What can I do on session timeout or browser close to update my DB? I would need to have the users id of course.
I have thought about a Body onUnload event but this does not seem to fire on browser close.
Any ideas would be great!
I have a site that will only allow 1 person to log in with a given username at one time. When someone logs in I change a field in the DB to hold the fact that they are logged in. If they actually log out then I am fine, the DB gets updated. However, the problem lies in if they timeout or close the browser.
I know that the session information is gone before we hit the Session_OnEnd event, which supposedly fires on browser close and session timeout so I can't use that information to ensure that I update my table appropriately.
Has anyone else had to handle this? What can I do on session timeout or browser close to update my DB? I would need to have the users id of course.
I have thought about a Body onUnload event but this does not seem to fire on browser close.
Any ideas would be great!