session timeout

P

polilop

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
 
E

Evertjan.

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.
 
J

Jerry Kizziar

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top