When using the ASP.NET
Identity, I want to persist the login information as long as possible when the user logs in to my website, so the user doesn't need to login again when they reopened their Browser (just like github.com and stackoverflow.com). When I login to github, it persists my information for many days, so I don't need to login again every day. Are there any methods can that can implement this functionality using ASP.NET
Identity?
Just pass the appropriate value to the isPersistent
argument of the SignIn methods:
SignInManager.PasswordSignInAsync("[email protected]", "password", isPersistent: true, shouldLockout: false);
or
SignInManager.SignInAsync(applicationUser, isPersistent: true, rememberBrowser: false);
The isPersistent
argument is used to control if the user's authentication cookie should be persisted.
The rememberBrowser
argument is used in case of Two Factor Authentication: a remembered browser can login directly with the password alone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With