[英]Increase the validity period of users in Identity
I'm migrating an ASP.NET website from the old membership provider to ASP.NET Identity.我正在将 ASP.NET 网站从旧的成员资格提供程序迁移到 ASP.NET Identity。 I use a new ASP.NET Core 5 MVC project.
我使用新的 ASP.NET Core 5 MVC 项目。
How to increase the validity period of users in Identity?如何增加Identity中用户的有效期?
This is my startup:这是我的启动:
services.AddIdentity<ApplicationUser,IdentityRole>(option => option.User.RequireUniqueEmail = true)
.AddEntityFrameworkStores<ProjectDbContex>()
.AddDefaultTokenProviders()
.AddErrorDescriber<PersianIdentityErrorDescriber>();
If you want to let the signed in user to keep sign in status longer, you can update the expire time by adding this code just behind your services.AddIdentity
.如果你想让已登录的用户保持登录状态更长时间,你可以通过在你的
services.AddIdentity
后面添加这段代码来更新过期时间。
builder.Services.ConfigureApplicationCookie(options =>
{
options.ExpireTimeSpan= TimeSpan.FromMinutes(1);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.