使用FormsAuthentication持久cookie超时

cda*_*a01 13 asp.net cookies forms-authentication remember-me

我正在创建一些"记住我"功能,作为登录的一部分.

当我在登录过程中使用以下内容创建持久性cookie时:

FormsAuthentication.SetAuthCookie("someusername", true);
Run Code Online (Sandbox Code Playgroud)

我的Web.Config看起来如下:

<authentication mode="Forms">
  <forms loginUrl="~/sign-in" timeout="2880" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

在要求用户再次提供其登录详细信息之前,cookie有效期为多久?此外,是否/设置持久性cookie时使用的默认时间长度是多少?

cda*_*a01 17

由于这篇文章,我找到了我正在寻找的答案:

Dan Sellers的WebLog

在哪里他说:

在ASP.NET 2.0中,基于持久性和基于会话的cookie的超时值由<forms/>元素的超时属性控制

所以在我的例子中,持久性cookie将在48小时后到期.