By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,212 Members | 1,182 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,212 IT Pros & Developers. It's quick & easy.

session timeout

P: n/a
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
Dec 10 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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)

Dec 10 '05 #2

P: n/a
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*100 0))/(60*1000)*1)
dsec=Math.floor((((time%(60*60*1000*24))%(60*60*10 00))%(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=dh our+':'+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

Dec 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.