Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Global.asa Session_OnEnd Problem

    Hi,

    Im having some problems with the Sub Session_OnEnd within the Global.asa

    It doesnt seem to want to trigger.

    Code:
    Sub Session_OnEnd
    Application.lock
    Application("ActiveUsers") = Application("ActiveUsers") - 1
    Application.unlock
    response.Redirect("http://www.yourdomain.com/Session_End.asp")
    End Sub
    All i want to do is response.redirect the user that his/her session has ended (of course only if he/she is still on the website)

    Any ideas ?

  • #2
    New Coder
    Join Date
    Jun 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Ok after some research i found that this is a common problem.

    So... this is my solution...

    i have an include page in all webpages on my website pages so i included the following within it..

    My Session.timeout = 30

    Within the include asp file i have ...
    Code:
    <% if Session("login") = "true" then %>
    <script language="javascript">
    //this will call the javascript method _SessionExpired after 20 minutes
    
    setTimeout( "_SessionExpired()", 31 * 60 * 1000 );
    
    function _SessionExpired()
    {
    alert('Your Session had Expired')
    location.href = "http://www.mydomain.com/";
    }
    </script>
    <%end if%>
    I set the javascript timeout to 31 minutes to allow the session.timeout to completley timeout before the javascript.

    This seems to work...as i change the page the session.timeout resets and so does the javascript.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •