C#web app计时器控件 [英] C# web app timer control

查看:151
本文介绍了C#web app计时器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#网络应用程序中控制Timer?说我的会话到期,我必须在10秒内重定向到登录页面。谢谢..

how can I control Timer in C# web app? say my session expires and I have to redirect to login page in 10 secs. thanks..

推荐答案

var t;
window.onload=resetTimer;
document.onkeypress=resetTimer;

function logout()
{
	alert("You are now logged out.")
	location.href='Logoff.aspx' 
}
function resetTimer()
{
	clearTimeout(t);
	t=setTimeout(logout,10000) //logs out in ten secs
}





试试这个



try this


这篇关于C#web app计时器控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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