Helping you always. Don't forget to click "Mark as Answer" on the post that helped you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Is it possible to automatically redirect to the login page when 20 minutes have elapsed?
You will need to reload your page every 20 minutes time from JavaScript. So if the user's timeout is already done then due to the page reload he will be redirected to the login page.
You can simply use the setInterval method of JavaScript to do the page reload every 20 minutes time.
Helping you always. Don't forget to click "Mark as Answer" on the post that helped you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
Member
2 Points
10 Posts
identity and session timeout
Jul 09, 2020 07:27 AM|MLT111|LINK
I use Identity core 3.1 . How can I complete a user's session after 20 minutes?
Participant
1253 Points
943 Posts
Re: identity and session timeout
Jul 09, 2020 09:33 AM|yogyogi|LINK
Use this code in the ConfigureServices() method of Startup class:
Identity cookie name is .AspNetCore.Identity.Application which you can check it in the developer tools of the browser (see below image).
More info see - Identity Cookie Timeout
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
Contributor
2720 Points
874 Posts
Re: identity and session timeout
Jul 09, 2020 09:46 AM|Rena Ni|LINK
Hi MLT111,
If you want to set expiration of identity cookie,set like below:
Best Regards,
Rena
Member
2 Points
10 Posts
Re: identity and session timeout
Jul 09, 2020 03:38 PM|MLT111|LINK
Is it possible to automatically redirect to the login page when 20 minutes have elapsed?
Contributor
2720 Points
874 Posts
Re: identity and session timeout
Jul 10, 2020 01:18 AM|Rena Ni|LINK
Hi MLT111,
Be sure you have added the following code,then it would automatically redirect to the login page:
Best Regards,
Rena
Participant
1253 Points
943 Posts
Re: identity and session timeout
Jul 10, 2020 05:40 AM|yogyogi|LINK
You will need to reload your page every 20 minutes time from JavaScript. So if the user's timeout is already done then due to the page reload he will be redirected to the login page.
You can simply use the setInterval method of JavaScript to do the page reload every 20 minutes time.
There are also some chrome extensions to do the automatic page reload after a given time. See https://chrome.google.com/webstore/detail/super-auto-refresh-plus/globgafddkdlnalejlkcpaefakkhkdoa?hl=en
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠