首页 asp.Net asp.net – 使用FormsAuthentication持久的cookie超时

asp.net – 使用FormsAuthentication持久的cookie超时

我正在创建一些“记住我”功能作为登录的一部分. 当我在登录过程中创建一个持久性的cookie,具体如下: FormsAuthentication.SetAuthCookie(someusername, true); 而我的Web.Config如下所示: authentication mode=Forms forms loginUrl=~/sign-in timeout=28

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

当我在登录过程中创建一个持久性的cookie,具体如下:

FormsAuthentication.SetAuthCookie("someusername",true);

而我的Web.Config如下所示:

<authentication mode="Forms">
  <forms loginUrl="~/sign-in" timeout="2880" />
</authentication>

Cookie会在多长时间内被有效提供,才能再次要求用户提供登录信息?
另外还有/设置持久性cookie时使用的默认时间是多少?

解决方法

我找到了我正在寻找的答案感谢这篇文章:

Dan Sellers’s WebLog

他说:

in ASP.NET 2.0 the timeout value of both persistent and session based
cookies are controlled by the timeout attribute on the<forms/>element

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

本文来自网络,不代表青岛站长网立场。转载请注明出处: https://www.0532zz.com/html/kaifa/asp-net/20201215/13807.html
上一篇
下一篇

作者: dawei

【声明】:青岛站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

返回顶部