【发布时间】:2014-12-15 08:44:22
【问题描述】:
我想通过 ASP.NET 身份配置的管理员后端更改 Session Timeout 或 IAppBuilder。
这个想法是摆脱 IIS 手动重置,只需在数据库中配置会话超时。
也就是说我们可以在ASP.NET MVC App的不同地方访问CookieAuthenticationOptions吗?
例如,我们可以在HomeController 中进行吗?
有办法吗?
STARTUP.AUTH.CS
public void ConfigureAuth(IAppBuilder app)
{
// It goes from Database
var sessionTimeout = Convert.ToInt32(SysConfigView.GetSysConfig().SessionTimeout);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromMinutes(sessionTimeout),
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
CookieName = ".MyApp_Authentication",
SlidingExpiration = true
});
// There is other code...
}
【问题讨论】:
标签: c# .net asp.net-mvc-5 asp.net-identity session-timeout