I programmed a web site, prepared a login mechanism(via textbox, not Login tools), users want to logout, they click logout button. However, my problem is that if users don’t click logout button or close web page or switch another one, How can I understand this situation?
According my mechanism, when users logout ,in DB some insertion and delete operation are making.
I also want to do this with closing page,switch another one.
Thanks.
I programmed a web site, prepared a login mechanism(via textbox, not Login tools), users
Share
It sounds like you’re doing a DB operation on logout, and when people just navigate away without clicking the logout button, the code doesn’t fire.
In your global.asax, take a look at session_end. Maybe you can put your operation in there.
Note that if you use this, it actually fires when the IIS session ends, not when the browser closes. By default the session times out after 20 minutes of inactivity.
Once you implement this, you could have your logout page call Session.Abandon, which will trigger Session_End. That seems clean to me.
Here’s an MSDN link with some more details on session events: http://msdn.microsoft.com/en-us/library/ms178583.aspx