1
我用我的應用程序會員的功能,我有以下登錄代碼:C#MVC3和成員讓我登錄(記住我)
if (!Membership.ValidateUser(email, password))
{
ViewBag.Message = "E-mail ou senha estão incorretos.";
return View();
}
else
{
FormsAuthentication.Authenticate(email, password);
var keep = keepMeLoggedIn == "true,false" ? true : false;
FormsAuthentication.SetAuthCookie(email, keep);
return Redirect("~/Home/Mural");
}
從昨天到現在,當我openned我的應用程序再次,我沒有登錄... 我聽說過,當你生成一個持久的cookie會話永不過期,是真的嗎?我做錯了什麼?我應該在web.config中添加其他信息嗎?
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="~/Usuario/Login" protection="All" timeout="360" cookieless="UseDeviceProfile" />
</authentication>
有人可以幫忙嗎?
謝謝您的回答TIHan,如果用戶選擇持久登錄,我希望我的會話永不過期。我怎麼能這樣做? –
我認爲唯一的方法就是增加超時時間。這是在幾分鐘內,所以26280000是50年。我認爲這是足夠的時間。 :) – TIHan