mvc identity cookie 超時

  • 139
  • 0

mvc identity cookie 超時

 

//Overriding the default session time out and enabling sliding expiration
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                Provider = new CookieAuthenticationProvider
                {
                    OnResponseSignIn = context =>
                    {
                        context.Properties.AllowRefresh = true;
                        context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(13);
                    }
                }
            });


https://forums.asp.net/t/2121970.aspx?OWIN+Authentication+ExpireTimeSpan+not+working

https://brockallen.com/2014/11/18/sliding-and-absolute-expiration-with-cookie-authentication-middleware/