会话在ASp.net中结束 [英] Session end in ASp.net

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

问题描述

如果用户在给定的时间间隔内未与浏览器进行交互,则假定10分钟.然后,我希望页面将重定向到error.aspx页面.如果用户持续保持与浏览器的交互,则不会发生会话超时.我该怎么办?
请给我答案.

If user does not interact with the browser for a given time interval suppose 10 mins. Then I want the page will redirected to the error.aspx page. If the user keep his interaction with the browser continuously then the session time out is not occurred. How can I do this ?
Please Give me the answer.

推荐答案

在Javascript中使用计时器-服务器的应用程序将在页面加载时终止,因此Javascript是最好的方法(它应该可以在所有浏览器中使用)
Use a timer in Javascript - the application at the server will terminate when the page is loaded, so Javascript is the best way here (and it should work in all browsers)
<html>
<head>
<script type="text/javascript">
function delayedRedirect(){
    window.location = "/error.aspx"
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 600000)">
</body>
</html>


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

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