Clear the session on browser close RRS feed

  • Question

  • User1082734430 posted


    Can you please suggest me the approach how can i clear the session on browser close. 

    I googled it and got many links, i tried to use  "onbeforeunload" event in jquery.  But this method is called even on redirection of the page. So i need to identify is it a browser or a redirection. In case of redirection i don't wanna do anything.

    I also tried Application_End and Session_End events but of no use.

     Please suggest me the approach how can i go ahead.

    Wednesday, August 20, 2014 1:05 PM


  • User753101303 posted


    IMO the best option is to educate your users (on the login page) so that they use the "logout" link made available to them. Basically you have no way to know (at least a reliable way) that the user closes the last window on your site.

    Perhaps later (if I remember there is a Windows api being worked on).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 20, 2014 1:31 PM

All replies