MVC 5注销超时

 斯高一耐 发布于 2023-01-07 10:17

要求用户每20分钟左右登录一次.

其中一种情况不知道在哪里看.我正在使用C#MVC 5 IdentityFramework 1.0.0

我希望将超时时间设为4小时.

直到现在我已经尝试过web.config:


  
      
      
  

在Startup.Auth.sc中:

app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            ExpireTimeSpan = TimeSpan.FromHours(4),
            CookieSecure = CookieSecureOption.Never,
            CookieHttpOnly = false,
            SlidingExpiration = true,
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login")
        });

我错过了什么?

编辑 - 解决方案

解决方案是将machineKey放在system.web下的web.config中.密钥生成器可以在http://aspnetresources.com/tools/machineKey找到

我还迁移到Identity 2.0并保留这些设置.使用此博客作为指导迁移:http://typecastexception.com/post/2014/07/13/ASPNET-Identity-20-Extending-Identity-Models-and-Using-Integer-Keys-Instead-of-Strings. ASPX

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有