要求用户每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