如何延长会话时间 [英] How Can I Extend Session Time
本文介绍了如何延长会话时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在c#中有asp.net网站。
用户是哪里工作,它突然退出用户。
我的代码:
DateTime tempdt = Convert.ToDateTime(util。 LongDateTimeFormat);
tempdt = tempdt.AddHours(+23);
MySession.Current.AdminConnectedDateTime = Convert.ToDateTime(tempdt);
Response.Redirect(InnerMain.aspx);
要求是,直到用户不登录不应该退出用户。
任何人都可以帮助我。
谢谢
解决方案
您好,
本文您需要:
ASP.NET中的会话超时时间 [ ^ ]
问候,
Praneet
1.在你的web.config
,sessionState
设置你应该将timeout
属性设置为更大的值,如下一个示例所示,其中值是24小时= 1440分钟
(通常没有用户会在网站上停留超过24小时):
< pre lang =HTML> < sessionstate mode = InProc < span class =code-attribute> cookieless = false timeout = 1440 / >
Hi guys,
I have asp.net website in c#.
Where user is working,it suddenly logout the user.
my code:
DateTime tempdt = Convert.ToDateTime(util.LongDateTimeFormat); tempdt = tempdt.AddHours(+23); MySession.Current.AdminConnectedDateTime = Convert.ToDateTime(tempdt); Response.Redirect("InnerMain.aspx");
the requirement is, till the user won't loggout it should not logout the user.
Can any one, please help me.
Thanks
解决方案
Hi,
This article has you need:
Alert Session Time out in ASP.NET[^]
Regards,
Praneet
1.In yourweb.config
,sessionState
setting you should set thetimeout
attribute to a bigger value like in the next example, where the value is24 hour =1440 minutes
(normally no user will stay longer then 24 hours on a site):
<sessionstate mode="InProc" cookieless="false" timeout="1440" />
2.You could find more details about thissessionState
setting in MSDN[^]
这篇关于如何延长会话时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文