加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 启用了slidingExpiration的FormsAuthentication没有

发布时间:2020-12-16 07:10:00 所属栏目:asp.Net 来源:网络整理
导读:我有一个带有FormsAuthentication的web应用程序,并且我的web.config中的slidingExpiration =“true”没有在每个请求中返回一个cookie,但是当我看到HTTP事务时,我看不到web服务器在每个请求中返回AUTH cookie. 检查docs,它应该. slidingExpiration Optional a
我有一个带有FormsAuthentication的web应用程序,并且我的web.config中的slidingExpiration =“true”没有在每个请求中返回一个cookie,但是当我看到HTTP事务时,我看不到web服务器在每个请求中返回AUTH cookie.

检查docs,它应该.

slidingExpiration Optional attribute. Specifies whether sliding
expiration is enabled. Sliding expiration resets the active
authentication time for a cookie to expire upon each request during a
single session. This attribute can be one of the following values.
Value Description True Specifies that sliding expiration is enabled.
The authentication cookie is refreshed and the time to expiration is
reset on subsequent requests during a single session. False Specifies
that sliding expiration is not enabled and the cookie expires at a set
interval from the time the cookie was originally issued. The default
is True.

有谁知道它为什么没有按预期工作?

干杯.

解决方法

我读过这个: http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net-security/2316/problem-with-slidingExpiration

In other words,if the elapsed time since ticket creation is greater
then half the ticket timeout (in your scenario would be 1 minute) the
the ticket won’t be renewed. Otherwise a new ticket will be granted
with a fresh timeout (2 mins in your case). Summarizing,if you hit
your page after 1 minute,it won’t extend your Forms session lifetime
regardless your slidingExpiration setting.

这很有道理,但我找不到任何官方消息来源.所以当我有空余时间时,我会测试自己.

干杯.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读