FormsAuthentication.SetAuthCookie

时间:2009-10-27 12:21:47

标签: cookies forms-authentication

嗨我们正在使用FormsAuthentication.SetAuthCookie(profile.Id, false);

现在的问题是这个cookie什么时候到期?

当我关闭所有浏览器时,它当然会过期但不会让浏览器保持打开状态,我不知道时间限制。

2 个答案:

答案 0 :(得分:2)

它取决于web.config中的Timeout属性。

答案 1 :(得分:0)

在web.config文件的system.web属性中,您必须设置以下内容:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>

然后你的cookie将会过期,具体取决于你在超时属性中设置的值。