会话超时后重定向到登录页面 [英] Redirect to login page after session time out
本文介绍了会话超时后重定向到登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
如果在asp.net C#中会话超时,如何将用户重定向到登录页面。
假设用户空闲。然后页面必须重定向到登录页面。
请提前帮助谢谢。
Dear all,
How to redirect user to login page if the session time out in asp.net C#.
suppose if the user is idle. then the page must be redirect to login page.
Please help Thanks in advance.
推荐答案
In Web.config
In Web.config
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="homePage.aspx" timeout="yourTime" name="UserLogin" path="/"/>
</authentication>
在login.aspx中。 cs
In login.aspx.cs
FormsAuthentication.RedirectFromLoginPage(username, persistent cookie?)
http://stackoverflow.com/questions/484964/asp-net-push-redirect-on-session-timeout [ ^ ]
if(Session["userid"].toString==null)
{
//Redirect to login page
}
这篇关于会话超时后重定向到登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文