We have an ASP.NET MVC 5 application that has been using Forms Authentication with sliding expiration. We recently switched to OWIN Cookie Authentication and are experiencing issues with our sessions not extending properly.
Previously, a session could be extended from an AJAX xhr request. With this configuration, however, they are not extending. I'm receiving a 200 for every request (both GET and POST) that should be extending, even after the server has killed the session.
The current setup is:
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext);
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationType = "Cookies",
CookieSecure = CookieSecureOption.SameAsRequest,
CookieName = Constants.CatalystPortalCookieName,
LoginPath = new PathString(url.Action(nameof(LoginController.Index), "Login")),
SlidingExpiration = true,
ExpireTimeSpan = TimeSpan.FromMinutes(20),
CookiePath = "/",
});
If I click a link that causes the entire page to be loaded as a document response, however, the server properly extends the session.
cache:false;
– Deflower