身份验证会话超时
Authentication session timeout
我正在使用 VS2013 .NET Framework 4.5.1 中的 MVC 模板提供的内置身份框架。
我正在或多或少地开箱即用地使用该功能。它一直运行良好。与我读过的其他帖子相比,我的 web.config 有:
<authentication mode="None" />
如何为经过身份验证的会话设置超时期限,即在用户登录后?
如果您使用的是 Owin 身份验证,则 App_Start
文件夹中的 StartUp.cs
文件中应该有类似这样的内容:
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
// here you go
ExpireTimeSpan = new TimeSpan(60000000000)
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
我正在使用 VS2013 .NET Framework 4.5.1 中的 MVC 模板提供的内置身份框架。
我正在或多或少地开箱即用地使用该功能。它一直运行良好。与我读过的其他帖子相比,我的 web.config 有:
<authentication mode="None" />
如何为经过身份验证的会话设置超时期限,即在用户登录后?
如果您使用的是 Owin 身份验证,则 App_Start
文件夹中的 StartUp.cs
文件中应该有类似这样的内容:
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
// here you go
ExpireTimeSpan = new TimeSpan(60000000000)
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}