2

I am trying to implement remember me feature into my MVC application and I'd like to accomplish it by using MVC Identity. Normally the session expires in one hour, however, whenever the user checks remember be checkbox, the expiration time would change to one week. I'm using cookie authentication. What is the correct way to approach this problem?

jElliot
  • 65
  • 8

1 Answers1

3

You just need to set IsPersistent to true to accomplish this when you sign in the user identity (you would want to also add some kind of remember me checkbox for the external flow probably as well)

If somebody checked the check box then IsPersisten should be true otherwise false.

 AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = <rememberMe> }, <userIdentity>);
Power Star
  • 1,724
  • 2
  • 13
  • 25