app.UseCookieAuthentication(new CookieAuthenticationOptions
{
SlidingExpiration = false, // needs to be set to true , default value is false
ExpireTimeSpan = System.TimeSpan.FromMinutes(20), // possible values: min. 5 minutes , max 14 days
CookieName = CookieName,
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = OnValidateIdentity(),
OnException = context => {
CommonLogger.Debug("Cookie authentication encountered some issues", context.Exception);
}
}
});
嗨,大家好,
我的 cookie 的 Expires/Max-Age 总是设置为“Session”。知道为什么上面的代码不起作用吗?
添加此代码也无济于事:
context.Properties.AllowRefresh = true;
context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(13);
谢谢