本文介绍了CookieAuthenticationOptions,ExpireTimeSpan不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的code:
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
ExpireTimeSpan = System.TimeSpan.FromMinutes(1),
LoginPath = new PathString("/Account/Login"),
LogoutPath = new PathString("/Account/LogOff")
});
但超过1分钟的登录会话更加活跃。此外,当时间已过期LogoutPath不叫。为什么呢?
But login session active more than 1 minute. Also, LogoutPath is not called when time is expired. Why?
推荐答案
它不会过期。
请确保你没有任何背景的AJAX的活动,因为它扩展了会话( SlidingExpiration
默认为true)。
Make sure you do not have any background ajax activity as it extends the session (SlidingExpiration
is true by default).
此外,我不得不手动删除旧Cookie我改变之后 ExpireTimeSpan
从the默认14天以较小的值。
Also I had to manually delete the old cookie after I changed ExpireTimeSpan
from the default 14 days to a smaller value.
这篇关于CookieAuthenticationOptions,ExpireTimeSpan不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!