默认时间段(20 分钟)后 mvc 5 会话超时 [英] mvc 5 session timeout after default period (20 mins)

查看:30
本文介绍了默认时间段(20 分钟)后 mvc 5 会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 MVC 5 站点有这样的 web.config:

My MVC 5 site has web.config like this:

<authentication mode="Forms">
  <forms name=".ADAuthCookie" loginUrl="~/Account/Login" 
       timeout="2880" slidingExpiration="true" protection="All" />
</authentication>

但超时不起作用.我在这里给出什么值并不重要,它总是在 20-30 分钟后过期.如何让用户保持登录更长时间或直到他们退出?

but timeout doesn't work. It doesn't matter what value I give here, it always expires after 20-30 mins. How can I maintain users logged in for longer period or until they sign-out?

有什么办法可以仅使用In-Proc"来实现这一点?或者我在这里遗漏了什么?

Is there any way I can achieve this using "In-Proc" only? Or I am missing something here?

推荐答案

您正在处理两个不同的问题,身份验证超时和会话超时.会话超时由 web.config 中的以下键控制...

You are dealing with two separate issues, auth timeout and session timeout. Session timeout is controlled by the following key in web.config...

  <system.web>
    <sessionState mode="InProc" timeout="30" />
  </system.web>

我不确定您遇到的是哪个,但我怀疑这是您遇到的会话超时而不是身份验证超时...尝试从您的表单标签中完全删除超时,看看这是否为您提供了所需的内容

I'm not sure which you are encountering but I suspect it is the session timeout you are encountering rather than the authentication timeout... Try removing the timeout from your forms tag entirely and see if that gives you what you are looking for.

更多信息在这里-asp.net mvc 中的表单超时问题

这篇关于默认时间段(20 分钟)后 mvc 5 会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆