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

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

问题描述

我的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?

有什么办法,我可以只使用实现这个进程内?还是我失去了一些东西在这里?

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

More information here- forms timeout issue in asp.net mvc

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

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