ASP.NET-MVC – Session never expired on stackoverflow.com, unless the user clicks logout

I am building an asp.net mvc application.
I hope the session will never expire, once the user logs in, unless the user clicks to log out.

< p>Is this the best way?

I used it

FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);

and set createPersistentCookie to true, but still Exit after a period of time.

implement sliding expiration. Keep expiration time at a reasonable value – One day, two weeks, maximum; each request (the simplest) or update the cookie at a specific interval.

I am building an asp.net mvc application.
I hope The session will never expire, once the user logs in, unless the user clicks to log out.

Is this the best way?

I used it

FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);

and set createPersistentCookie to true, but still Log out after a period of time.

Achieve sliding expiration. Keep expiration time at a reasonable value-one day, two weeks, maximum; every request (Easiest) or update the cookie at a specific interval.

Leave a Comment

Your email address will not be published.