即使活动也重定向到登录页面 [英] redirected to login page even with activity
问题描述
嗨.
我在我的Web应用程序中遇到问题,在该应用程序中,我将表单超时设置为15分钟(这是当用户未进行任何活动时),会话也将在15分钟后结束(会话状态超时我在web.config中设置为15分钟). />
但是即使有活动,它也会自动将我重定向到登录页面.
大家有什么想法可以解决这个问题吗?
Hi.
I m having problem with my web application where i set the form timeout to 15 mins (this is when no activity from user) and session ends after 15 minutes as well (session state timeout i set to 15 mins in web.config)
But even there''s activity,it automatically redirects me to login page.
Any ideas guys how to overcome this issue?
推荐答案
如果您有母版页,则将陷阱放入
母版页代码后面.
示例代码:
在您登录的页面代码后面应有内容
Hi,
If you have a master page then put the trapping in
masterpage code behind.
Example code:
In you login page code behind should content
Session["UserId"] = user.UserId;
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager s = Page.ClientScript;
if (!IsPostBack)
{
txtUserId.Text = Session["UserId"];
// ...
if (txtUserId.Text == string.Empty)
{
Response.Redirect("login.aspx");
}
//... Some code here?
}
//... some code here?
}
如果会话过期,则 Session ["UserId"] 自动
应该内容为空,因此重定向到登录页面...
希望这可以帮助...
如果可以帮助,别忘了投票 ...
If ever the session expire, the Session["UserId"] automaticaly
should contents empty, therefore redirecting to login page...
Hope this could help...
Do not forget to vote if could help...
Regards,
请检查GLOBAL.asax SESSION_ONEND事件中是否有任何重定向代码,将其删除
Please check GLOBAL.asax is there any redirection code in SESSION_ONEND EVENT, remove it
这篇关于即使活动也重定向到登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!