如果用户在asp.net项目中处于空闲状态,如何重定向到登录页面 [英] how to redirect to login page if the user is idle in asp.net project

查看:62
本文介绍了如果用户在asp.net项目中处于空闲状态,如何重定向到登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友!!!



我想重定向到登录页面,如果用户闲置的话。



如果用户使用用户名和密码登录并且不使用该应用程序...超过10分钟..必须重定向到登录页面。



请你帮我。



谢谢....

解决方案

javascript-redirect-to-another-page.html [ ^ ]



http://www.aspdotnet-suresh.com/2012/10/jquery-redirect-to-another-page-after-5.html [ ^ ]



这个链接可以帮到你


试试这个javascript代码

< script type =   text / javascript> 

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

函数logout()
{
alert(
你现在已经注销。 < span class =code-string>)
location.href ='Logoff.php'
}
function resetTimer()
{
clearTimeout(t);
t = setTimeout(logout,600000)//在10分钟内注销
}

< / script>


会话时间超过15分钟&检查贝娄



<前lang =sql> 检查 用户会话变量 null 如果 null 然后重定向登录页。

if (会话[ 用户] == null
{Response.Redirect( Login.aspx);
}


hello frienDs !!!

I want to redirect to login page, if the user is idle.

if the user logins with username and password and not uses the application for sometime...more than 10 minutes..It must redirect to login page.

Please can you help me.

Thanks....

解决方案

javascript-redirect-to-another-page.html[^]

http://www.aspdotnet-suresh.com/2012/10/jquery-redirect-to-another-page-after-5.html[^]

This links will help you


try this javascript code

<script type="text/javascript>

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

function logout()
{
	alert("You are now logged out.")
	location.href='Logoff.php' 
}
function resetTimer()
{
	clearTimeout(t);
	t=setTimeout(logout,600000) //logs out in 10 min
}

</script>


Made session time out 15 min & check for bellow

Check the user session variable is null or not,if it is null,then redirect to login page.

if (Session["User"] == null)
{  Response.Redirect("Login.aspx");
}


这篇关于如果用户在asp.net项目中处于空闲状态,如何重定向到登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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