Results 1 to 2 of 2

Thread: Session End

  1. #1
    Join Date
    Aug 2004

    Session End

    Im making a forum which displays the names of all online users by using "SELECT tblUsers.alias FROM tblUsers WHERE tblUsers.status='online'". But then I need to change there status when they close the browser or the session timesout. Is there another way around it than using session_onEnd because I heard that isnt very reliable, also if i do use this can I still get session variables inside the onEnd function?

  2. #2
    Join Date
    Sep 2004
    To end a session when the user closes the browser window you need to add a new page to your site. For example, add a page named sessEnd.asp. This page should need only one line of code:


    You can also add some extra html here and use it as the target of a Logout link from anywhere in your site. From a link the page will display. From the code example below, it will not show, but will execute.

    Using Javascript force a post to this page when the user closes the browser or navigates away from your site. Here is a function that will do it.

    <script language="JavaScript">
    function ForceSubmit(){



    <form ACTION="sessEnd.asp" METHOD="post" id="sessEnd" name="sessEnd">
    <body onUnload="ForceSubmit()">

    The Session_OnEnd event occurs whenever Session.Abandon is explicitly called or when the current session times out due to inactivity. This is usually 20 minutes by default.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles