我的Startup.cs
services.AddIdentity<MasterUser, IdentityRole>(config =>
{
config.User.RequireUniqueEmail = true;
config.Cookies.ApplicationCookie.AccessDeniedPath = new PathString("/Authentication/Login");
config.Cookies.ApplicationCookie.LoginPath = new PathString("/Authentication/Login");
config.Cookies.ApplicationCookie.LogoutPath = new PathString("/Authentication/Login");
config.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromDays(36500);
config.Cookies.ApplicationCookie.SlidingExpiration = true;
})
.AddUserManager<MasterUserIdentityManager>()
.AddUserStore<MasterUserIdentityClaimStore>()
.AddEntityFrameworkStores<MasterDatabaseContext>();
ExpireTimeSpan
设置为100年,而SlidingExpiration
设置为true,但应用程序会在约35分钟后注销经过身份验证的用户,即使它们处于活动状态也是如此。就好像这些设置由于某种原因而未应用。
答案 0 :(得分:1)
认为您可能还需要设置SecurityStampValidationInterval
config.SecurityStampValidationInterval = TimeSpan.FromDays(36500);;