Results 1 to 2 of 2

Thread: Session Timeout

  1. #1
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Session Timeout

    Hi all,

    I have a login script in ASP and would like to have a JS message box popup when the users session is about to time out.

    So if i have a fixed session of 20min I would like to warn them when there is only 2 mins left before the session times out.

    Can this be done?

  2. #2
    Join Date
    Nov 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OK here is what i ended up with

    <script language="javascript" type="text/javascript">

    var lTime=29*60;
    function LogoutTimer() {

    lTime=lTime-1;

    var lMins=(lTime-(lTime%60))/60;
    var lSecs=lTime%60;

    window.status="Auto Logout: " + lMins + " Min " + lSecs + " Sec" ;

    //5 min warning
    if (lMins==5 & lSecs==0) {
    alert('You will be automatilly logged out in 5 minutes. Please save you work now to ensure no work is lost.');
    }

    //timeout warning
    if (lMins==0 & lSecs==0) {
    alert('You session has timed out. You will need to login again. Please make a copy of your work before you do anything else as it may be lost.');
    }

    }

    window.setInterval("LogoutTimer()",1000);
    LogoutTimer();

    </script>

Bookmarks

Posting Permissions

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