Answer the question
In order to leave comments, you need to log in
Timeout of "session" after authorization in asp.net core (.NET 5) identity, how to make not 20 minutes?
Good evening. It’s like I’m still studying asp net core, I don’t understand how to regulate the time of the "identity authorization session", that is, not just a session, but user authorization
Everything works and so on, but here's a crash 20 minutes after
Startup.cs authorization
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<IdentityUser, IdentityRole>(config =>
{
config.Password.RequiredLength = 6;
config.Password.RequireDigit = false;
config.Password.RequireNonAlphanumeric = false;
config.Password.RequireUppercase = false;
config.Lockout.AllowedForNewUsers = true;
config.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(2);
config.Lockout.MaxFailedAccessAttempts = 5;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.ConfigureApplicationCookie(config =>
{
config.Cookie.Name = "My.Cookie";
config.LoginPath = "/Account/Login";
config.Cookie.HttpOnly = true;
config.SlidingExpiration = true;
config.ExpireTimeSpan = TimeSpan.FromHours(18);
});
services.AddControllersWithViews();
app.UseAuthentication();
app.UseAuthorization();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question