How to configure user downtime in Asp.Net Core?

Asked

Viewed 175 times

0

I started studying Asp.Net Core these days, I’m working with version 2.1. I can already log in and log out of the user, only I don’t know how to set his downtime.

I put this code, but after a few minutes it asks the login again

services.ConfigureApplicationCookie(options => {
    options.LoginPath = PathString.FromUriComponent("/Account/Login");
    options.ExpireTimeSpan = TimeSpan.FromHours(24);
});

Compared to real systems, I look for something like Facebook does, where you log in 1 time, and if you log in regularly it does not ask login.

What should I set up to do this?

From now on, thank you for your attention.

  • Identity? which version of . net core?

  • Version 2.1 <TargetFramework>netcoreapp2.1</TargetFramework>

  • Yes, I am using Identity with my custom classes, because I use an existing database

1 answer

1

Hello, for the refresh to work you need to set another setting within the call options Slidingexpiration for true.

Now to ensure that these settings are not overwritten you will need to put your code after the Addidentity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.