Is it possible to set session timeout to 1 minute in Asp.net?

帅比萌擦擦* 提交于 2019-12-24 06:01:04

问题


For testing purpose I want to set session timeout to 1 minute - is it possible?

I have defined timeout as 1 minute in web.config, but it is not working (I heard default timeout is 20 minutes so minimum 20?)

<sessionState mode="StateServer" cookieless="false" timeout="1"/>

回答1:


Yes, you can set it to less than 20 minutes. Default 20 doesn't means minimum 20 .

Also, you used <sessionState> element of Web.config, so set it as:

<sessionState mode="StateServer" cookieless="false" timeout="1" />

Check this forum on asp.net : http://forums.asp.net/t/1725273.aspx/1




回答2:


A session starts every time a new user hits the website, regardless of whether or not they are anonymous. Authentication has very little to do with Session.

Authentication timeout is the amount of time that the authentication cookie is good for on the user's browser. Once the cookie expires, they must re-authenticate to access protected resources on the site.

So, if Session times out before the Authentication cookie - they are still authenticated, but all their session variables disappear, and may cause errors in your website if you are not disciplined in checking for nulls and other conditions brought about by missing session.

If Authentication times out before the session, then all their session variables will still exist, but they won't be able to access protected resources until they log back in again.




回答3:


Check this url. It may helpful

http://www.aspdotnet-suresh.com/2010/10/session-timeout-problem-in-aspnet.html




回答4:


set <sessionState mode="StateServer" cookieless="false" timeout="1" />



来源:https://stackoverflow.com/questions/18503784/is-it-possible-to-set-session-timeout-to-1-minute-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!