表单认证超时与sessionState超时(Forms authentication timeout vs sessionState timeout)

系统教程 行业动态 更新时间:2024-06-14 17:01:34
表单认证超时与sessionState超时(Forms authentication timeout vs sessionState timeout)

我有代码,我正在查看网站的会话超时。 在web.config中我遇到了这个代码。

<authentication mode="Forms"> <forms loginUrl="~/Auth/SignOn.aspx" timeout="40" slidingExpiration="true" /> </authentication> <sessionState timeout="30" />

有没有人知道一个人是否先于另一个,以及它们是如何不同的。 谢谢。

I have code that i am looking through regarding session time outs of the website. In the web.config i came across this code.

<authentication mode="Forms"> <forms loginUrl="~/Auth/SignOn.aspx" timeout="40" slidingExpiration="true" /> </authentication> <sessionState timeout="30" />

Does anyone know if one takes precedent over the other, and how they are different. Thanks.

最满意答案

他们是不同的东西 表单验证超时值设置认证cookie设置为有效的时间(以分钟为单位),这意味着,在分钟数之后,cookie将过期,用户将不再被认证 - 它们将被重定向到自动登录页面。 slidingExpiration=true值基本上是说,在每次请求完成后,定时器被复位,只要用户在超时值内提出请求,它们将继续被认证。 如果设置slidingExpiration=false ,则无论用户是否在超时值内发出请求,认证cookie将在value分钟后到期。

SessionState超时值设置会话状态提供者在特定会话中保存内存(或正在使用的任何后台存储,SQL Server,OutOfProc等)中的数据所需的时间。 例如,如果您使用示例中的值在Session中放置一个对象,则此数据将在30分钟后被删除。 用户仍然可以被认证,但会话中的数据可能不再存在。 每次请求后, Session Timeout值始终重置。

They are different things. The Forms Authentication Timeout value sets the amount of time in minutes that the authentication cookie is set to be valid, meaning, that after value number of minutes, the cookie will expire and the user will no longer be authenticated - they will be redirected to the login page automatically-. The slidingExpiration=true value is basically saying that after every request made, the timer is reset and as long as the user makes a request within the timeout value, they will continue to be authenticated. If you set slidingExpiration=false the authentication cookie will expire after value number of minutes regardless of whether the user makes a request within the timeout value or not.

The SessionState timeout value sets the amount of time a Session State provider is required to hold data in memory (or whatever backing store is being used, SQL Server, OutOfProc, etc) for a particular session. For example, if you put an object in Session using the value in your example, this data will be removed after 30 minutes. The user may still be authenticated but the data in the Session may no longer be present. The Session Timeout value is always reset after every request.

更多推荐

timeout,code,web,config,电脑培训,计算机培训,IT培训"/> <meta name="descr

本文发布于:2023-04-20 18:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/cfcd95d6242d420cde05763439d8d0e2.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   sessionState   Forms   authentication   timeout

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!