[SOLVED] How do I create an auto timeout for users that redirect to login page?

Issue

I want to add a section to my site which will logout the user and redirect them to the log in page. I want to do this so no user is idle or keep one login secession open for more than 24 hours. How would I create an auto timeout in c#?

Solution

Are you using Identity framework? If yes, you will find IdentityConfig.cs class in
App_Start folder. In ApplicationUserManager add the following line of code or set the value as per your requirements.

manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(15);

Answered By – Ahmed Naeem

Answer Checked By – Cary Denson (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *