Thread: Session in ASP

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    34
    Rep Power
    3

    Session in ASP


    Hi all,

    I just want to know if there any asp code can make auto redirect from one page to another page when the session timeout end ?
    Any solution for this problem ?
    I need a solution ASAP, so help me please.

    Thank You.
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    If your server supports global.asa you may be able to do something with the session.OnEnd event. I don't have any instant solution, keep googling I think I've seen similar questions elsewhere.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Use an onload event to start a timer, and then redirect the page after sometime. Well this is just a javascript. Hope this will help.

    For the timer, use the window.setTimeout function.
    For the redirect, set the value of window.location.

    Code:
    <head>
    <script type="text/javascript">
    <!--
     function redirect(url) {
       window.location = url;
     }
     function beginSessionTimer() {
       // 30000ms = 30s
       window.setTimeout(redirect, 30000, 
                         "http://www.yoursite.com/login.asp?session=clear");
     }
    //-->
    </script>
    </head>
    <body onload='beginSessionTimer();'>
    </body>
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    34
    Rep Power
    3
    Thanks a lot.

IMN logo majestic logo threadwatch logo seochat tools logo