设置Forms认证的cookie失效时间
来源:互联网 发布:数据精灵授权码 编辑:程序博客网 时间:2024/05/18 21:07
永久性 Cookie 由所有使用同一个 Cookie 存储的应用程序共享,而且用户可以在客户端应用程序中打开文档。创建的永久性 Cookie 具有 30 分钟的默认超时值。通过在 Web.config 文件中的表单节点内添加或更新超时参数,可以更改此值。例如:
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" timeout="100" />
例:
<authentication mode="Forms">
<forms loginUrl="~/Default.aspx"
name=".MetaTagUser"
defaultUrl="~/Review/Default.aspx"
timeout="30"
slidingExpiration="true" />
</authentication>
<membership defaultProvider="MetaTagSqlProvider" userIsOnlineTimeWindow="30">
<providers>
<remove name="AspNetSqlProvider" />
<add name="MetaTagSqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="DSN_MemberStore"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
passwordFormat="Hashed"
minRequiredNonalphanumericCharacters="0"
minRequiredPasswordLength="5"
applicationName="/MetaTag" />
</providers>
</membership>
<roleManager enabled="true"
cacheRolesInCookie="false"
cookieName=".MetaTagRoles"
cookieTimeout="30"
cookieSlidingExpiration="true"
cookieProtection="All"
defaultProvider="MetaTagSqlRoleProvider"
createPersistentCookie="false"
maxCachedResults="25">
<providers>
<remove name="AspNetSqlRoleProvider"/>
<add connectionStringName="DSN_MemberStore"
applicationName="/MetaTag"
name="MetaTagSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
1. Specifies the amount of time, in integer minutes, after which the cookie expires. The default value is 30. If the SlidingExpiration attribute is true, the timeout attribute is a sliding value, expiring at the specified number of minutes after the time the last request was received. To prevent compromised performance, and to avoid multiple browser warnings for users that have cookie warnings turned on, the cookie is updated when more than half the specified time has elapsed. This might result in a loss of precision. Persistent cookies do not time out.
2. The UserIsOnlineTimeWindow property value is checked during the call to GetNumberOfUsersOnline. If the LastActivityDate for a user is greater than the current date and time minus the UserIsOnlineTimeWindow value in minutes, then the user is considered online. You can determine whether a membership user is considered online with the IsOnline property of the MembershipUser class.
3. The CookieTimeout property is used when the CookieSlidingExpiration property is true and specifies the time-to-live in minutes for the roles cookie. To set the CookieTimeout value, add the cookieTimeout attribute to the roleManager element in the Web.config file for the ASP.NET application and specify an integer value.
- 设置Forms认证的cookie失效时间
- cookie失效时间的设置
- 设置cookie指定时间失效
- 设置cookie指定时间失效
- Asp.Net的Forms验证,解决Cookie和Seesion失效时间
- Volley请求Cookie超时/Token认证失效的处理
- forms认证的学习
- Cookie的过期时间设置
- memcached的失效时间设置注意点
- 三种设置session的失效时间
- forms认证的学习(2)
- WebConfig 设置权限 Forms 身份认证
- 设置Session失效时间
- 设置Session失效时间
- session失效时间设置
- 设置session失效时间
- 设置session失效时间
- session失效时间设置
- J2EE基础:对于Spring初学者的学习建议
- IIS身份验证
- 初学者如何开发出一个高质量的J2EE系统
- expat函数指南
- Using Expat[1]:What is expat?
- 设置Forms认证的cookie失效时间
- Using Expat[2]:Overview of Expat
- WebLogic Server10.0手册翻译(WebLogic Server Performance and Tuning册的第五章)
- struts2的action中获得request response session 对象
- Using Expat[3]:Expat Function Reference
- 独立思考
- Linux服务器集群系统(五)LVS
- EF下LINQ to Entities不支持语法及替代方案
- hibernate分页