How do I Fire Session_End() when user exits site ?

Discussion in 'ASP.NET / ASP.NET Core' started by albanello, Mar 27, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I want to restrict a maintenance page to only allow one staff member to have access at a time !

    I tired to user a Public Shared bool to signal someone was using the page and a Session bool to mark the session that was allowed usage. Everything worked fine for entry and usage BUT I was unable to get the Session_End() to release the Public Shared bool when the user closes the browser.

    After researching it sound to me like the Session_End() is fired only after timeout and NOT when the user closes the browser.

    Can someone tell me a way to release the Public Shared bool so the next Staff member does not need to wait 20 minutes before anyone else can sign on ?

    I am writing a Web Application using ASP.NET 1.1, Visual Basic and MS SQL.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    i don't think there's a easy way to do this because HTTP is a stateless protocol. Once the web server sends the request, it has no knowledge whether the user stay on the page, close the browser or move on to another page.

    The only way I can see this done is by some sort of client side script that does a post back to the server under certain condition (eg. when they close the browser)

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Thanks Bruce


    That is a interesting idea. I'll have to research Java Script and see how to do this. Thanks for your responce.


    albanello
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page