1
如果我將會話超時設置爲少於20分鐘,則一切工作正常。ASP.NET MVC會話超時不起作用
但是,如果它是> 20分鐘它不工作。它發生在VS 2013和Production IIS上。
這是我使用的代碼。
如何解決該問題?謝謝!
STARTUP.AUTH
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
var sessionTimeout = 5;
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromMinutes(sessionTimeout),
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
}
的Global.asax
protected void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 5;
}
附: WEB.CONFIG
<sessionState mode="InProc" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" defaultUrl="~/Account/Login" name="MyApp123" />
</authentication>
您是否嘗試過使用ExpireTimeSpan = new TimeSpan(0,0,5,0) – DSR 2014-10-17 13:53:55
解釋「無效」的含義。沒有超時?它仍然在20分鐘時間?根本沒有會話?你如何衡量它是否超時?僅供參考,身份驗證超時不是會話超時,它們是兩件不同的事情。 – 2014-10-17 16:29:13
@ErikFunkenbusch看,我通過我的代碼設置超時10小時。但它會在20分鐘後過期。這是問題。 – 2014-10-17 16:35:24