session timeout

Discussion in 'ASP General' started by polilop, Dec 10, 2005.

  1. polilop

    polilop Guest

    Is there a way to see if the session is going to timeout and then warn the
    user or display a page that it timed out
    polilop, Dec 10, 2005
    #1
    1. Advertising

  2. polilop

    Evertjan. Guest

    polilop wrote on 10 dec 2005 in microsoft.public.inetserver.asp.general:
    > Is there a way to see if the session is going to timeout and then warn
    > the user or display a page that it timed out


    Set a clientside code timer that is reset on each new page and
    that fires after less than 20 minutes.

    Not ideal, eh?

    Better warn them if they try something while no more in session,
    that is while needing to login again an arriving there
    not from the normal starting page.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Dec 10, 2005
    #2
    1. Advertising

  3. This code seems to work good for me:

    <div class="skeleton" id="timer" style="color:gray;font-family: Verdana;
    font-size: 8pt">

    </div>
    <script language=javascript>
    var dd=<%= Session.Timeout*60-2 %>;
    var csptimeout=0;
    function CSPstartClock(reset,timeout,whatdoc,towhere) {
    if (reset) {
    md=dd
    }
    if (md>0) {
    time=md*1000
    if (csptimeout!=0) {
    clearTimeout(csptimeout);
    }
    csptimeout=setTimeout("CSPstartClock(0)",1000)
    dhour=Math.floor((time%(60*60*1000*24))/(60*60*1000)*1)
    dmin=Math.floor(((time%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
    dsec=Math.floor((((time%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
    dsecDisplay = dsec.toString() ;
    dminDisplay = dmin.toString() ;
    if (dminDisplay.length == 1) {
    dminDisplay = "0" + dminDisplay ;
    }

    if (dsecDisplay.length == 1) {
    dsecDisplay = "0" + dsecDisplay ;

    self.document.getElementById('timer').innerHTML=dhour+':'+dminDisplay+':'+dsecDisplay+' remaining until session timeout';
    }
    else {
    if(timeout==null) { timeout='1790'}
    if(whatdoc== null) { whatdoc=''; if(whatdoc=='')
    {whatdoc='document.location.href';}}
    if(towhere==null) { towhere='/osc2.0/osc_scripts/abandonSession.asp';}
    mycounter = setTimeout(whatdoc+'="'+towhere+'"',1000)
    }
    md=md-1
    }

    CSPstartClock(1);

    </script>

    "polilop" wrote:

    > Is there a way to see if the session is going to timeout and then warn the
    > user or display a page that it timed out
    >
    >
    >
    Jerry Kizziar, Dec 11, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    6,337
  2. bruce barker

    Re: ASPX Page Timeout - Session Timeout

    bruce barker, Jul 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    11,091
    ASP.Confused
    Jul 20, 2004
  3. =?Utf-8?B?Q3JhaWc=?=

    formsauthentication timeout & session timeout

    =?Utf-8?B?Q3JhaWc=?=, Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,630
    =?Utf-8?B?RU5JWklO?= .enizin.net>
    Aug 10, 2005
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,245
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,261
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page