会话超时 [英] session timeout

查看:83
本文介绍了会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法查看会话是否会超时,然后警告

用户或显示一个超时的页面

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于2005年12月10日在microsoft.public.inetserver.asp.general中写道:
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




设置在每个新页面上重置的客户端代码计时器和

不到20分钟就会开火。


不太理想,呃?


如果他们在没有会话的情况下尝试某些事情,最好警告他们

需要再次登录才能到达那里

不是来自正常的起始页面。


-

Evertjan。

荷兰。

(用我的电子邮件地址替换所有带点的十字架)



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)


这段代码似乎对我有用:


< div class =" skeleton" ID = QUOT;计时器" style =" color:gray; font-family:Verdana;

font-size:8pt">


< / div>

< script language = javascript>

var dd =<%= Session.Timeout * 60-2%> ;;

var csptimeout = 0 ;

函数CSPstartClock(重置,超时,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((时间%(60 * 60 * 1000 * 24))/(60 * 60 * 1000)* 1)

dmin = Math.floor(((时间%( 60 * 60 * 1000 * 24))%(60 * 60 * 100 0))/(60 * 1000)* 1)

dsec = Math.floor((((时间%(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 +''剩余到会话超时'';

}

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"写道:
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



这篇关于会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆