【发布时间】:2018-01-12 18:32:17
【问题描述】:
我正在使用带有 OWIN 身份验证的 MVC 5。 这是我的 StartUp.cs 的代码。
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
ExpireTimeSpan = new TimeSpan(60000000000)
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
过期时间设置为 60000000000 纳秒。
现在的要求是当cookie过期时,我需要重定向到登录屏幕。
怎么做?
【问题讨论】:
-
只是为了好奇,TimeSpan的单位是100纳秒单位,所以应该是60000000000“100纳秒”单位。 1 纳秒 = 1/1000000 毫秒。 100 纳秒 = 1/10000 毫秒
标签: owin