我正在使用OWIN身份驗證的MVC 5。 以下是我的StartUp.cs的代碼。OWIN身份驗證和超時
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毫秒 –