對於我的網站我配置的登錄會話超時1周在web.config文件會話超時不適用於asp.net mvc 4 C#。爲什麼?
<system.web>
<httpRuntime />
<!-- Session keeps for 7 days -->
<sessionState timeout="10080"></sessionState>
<authentication mode="Forms">
<forms loginUrl="~/" timeout="10080" slidingExpiration="true"/>
</authentication>
<!-- Configuration end -->
</system.web>
這裏是登錄代碼
[AllowAnonymous]
[HttpPost]
public ActionResult Login(string Login, string Password)
{
// empty passwords are not allowed
if (Password == "")
return Redirect(Request.UrlReferrer.ToString());
bool LoginResult = WebSecurity.Login(Login, Password, true);
return Redirect(Request.UrlReferrer.ToString());
}
我登錄,關閉瀏覽器,然後再次打開它去我網站 - >用戶登錄。 我關閉瀏覽器,等待一段時間(大約30分鐘)去我的網站 - >用戶註銷。 爲什麼?會議應存儲7天,但我們甚至沒有30分鐘。 Whan可能是問題的根源?
編輯1主要的想法是,我想回去到現場數天,並仍與登錄用戶
您確定要在上次訪問後將數據保留在內存中7天嗎? –
是的,這是內部網站,只有3個用戶,我累了每次輸入憑證 – Vitalii
當我們從mvc3移動到4時,我們遇到同樣的問題。 – MBen