I am using authentication mode=forms
in web.config file. Because it is a secure application so I want to ex开发者_C百科pire my session in 5 minutes. Right now I am doing it in programming in codebehind.
You should do it in Web.config file. This will expire Session
<configuration>
<system.web>
<sessionState
mode="InProc"
cookieless="true"
timeout="5" />
</system.web>
</configuration>
Other option is, This will expire cookie
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" timeout="5" path="/" slidingExpiration="true">
</forms>
</authentication>
You can do it from c#
HttpContext.Current.Session.Timeout = 5;
See http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx, there is timeout parameter.
Is this what you're looking for?
<system.web>
<authentication mode="Forms">
<forms timeout="5"/>
</authentication>
</system.web>
精彩评论