Nic*_*ick 26 asp.net authentication forms-authentication
使用此web.config元素设置会话状态超时
<sessionState mode="InProc" cookieless="false" timeout="120" />
Run Code Online (Sandbox Code Playgroud)
表单auth是使用此web.config元素配置的
<system.web>
<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="30"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false" />
</authentication>
</system.web>
Run Code Online (Sandbox Code Playgroud)
每个元素中指定的超时之间有什么区别?如果两者不同,它会如何工作?
wom*_*omp 58
每当新用户访问网站时,会话就会开始,无论他们是否是匿名用户.身份验证与Session几乎没有关系.
身份验证超时是身份验证cookie在用户浏览器上有用的时间.一旦cookie过期,他们必须重新进行身份验证才能访问站点上受保护的资源.
因此,如果Session在Authentication cookie之前超时 - 它们仍然经过身份验证,但它们的所有会话变量都会消失,如果您在检查由于缺少会话而导致的空值和其他条件时没有遵守规则,则可能会导致您的网站出错.
如果身份验证在会话之前超时,则其所有会话变量仍将存在,但在重新登录之前,它们将无法访问受保护的资源.
| 归档时间: |
|
| 查看次数: |
21939 次 |
| 最近记录: |