How to increase session timeout in ASP.NET MVC
By FoxLearn 2/18/2024 1:29:22 AM 40
This post shows you How to increase session timeout in ASP.NET MVC
Open the web.config file, then increase the value in minutes by using the time out attribute of SessionState element.
<system.web> <sessionState timeout="300"></sessionState> </system.web>
By default, the session timeout value is 20 minutes. Also in your case if you are using forms authentication, please check the timeout value.
<system.web> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" protection="All" path="/" timeout="300" /> </authentication> </system.web>
Open IdentityConfig.cs, then change the value of the account logout time span that you want to change.
public class ApplicationUserManager : UserManager<CustomUser> { public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) { var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>())); // Configure user lockout defaults manager.UserLockoutEnabledByDefault = true; manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromDays(1); manager.MaxFailedAccessAttemptsBeforeLockout = 5; return manager; } }
- How to fix "InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager'"
- How to fix 'IMvcBuilder' does not contain a definition for 'AddNewtonsoftJson'
- ASP.NET Core: How to Create RDLC Report in ASP.NET Core
- ASP.NET MVC: Free Responsive Templates
- How to fix Assets file 'project.assets.json' not found
- How to fix 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer'
- How to set cookie ValidationInterval in ASP.NET Core
- How to fix LoginPath not working in ASP.NET Core
Categories
Popular Posts
Visual Studio: Auto increment version
04/01/2024
What is ARM architecture?
04/01/2024