使用表单身份验证时 <sessionState> 超时被忽略的可能性有哪些?

What are possibilities that <sessionState> timeout is ignored when using forms authentication?

我们是 运行 .NET 4.5 上的 MVC 应用程序,我正在研究 sessionState 和表单身份验证的会话超时:

web.config:

<system.web>
  <sessionState timeout="1"></sessionState>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime targetFramework="4.5" />
  <authentication mode="Forms">
    <forms loginUrl="~/Account/LogOn" timeout="2" />
  </authentication>
  <!-- some more tags ... -->
</system.web>

据此,我认为我应该在 1 分钟不活动后注销,但我没有。我确实在 2 分钟后注销了。

我想知道这是为什么?我们不在会话中保存或存储任何内容,但这有关系吗?

会话状态与您的登录状态无关。您可以登录,但可以创建和放弃多个会话,所有这些都无需注销。

这是一个合理的事件序列:

  1. 会话开始
  2. 用户登录
  3. 会话超时
  4. 会话开始
  5. 会话超时
  6. 会话开始
  7. 用户注销
  8. 会话超时