2

I'm working on a website that has a short idle timeout and want to tell the user when their session is about to end. The website uses cookie authentication and the idle timeout is when the cookie has expired:

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = "Cookies",
    SlidingExpiration = true,
});

In order to notify the user I need to know when the cookie is about to expire.

I've tried using the OnValidateIdentity method as per this question, however the value in the authentication ticket is wrong for the request which extends the sliding expiration, meaning that occasionally I tell the user that their session is about to expire when it has actually just been extended.

How can I reliably get the cookie expiry time out of the OWIN middleware?

Community
  • 1
  • 1
Justin
  • 84,773
  • 49
  • 224
  • 367

0 Answers0