我有這樣的代碼,當用戶被授權可以在運行:cookie過期或會話超時太快
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
1,
email,
DateTime.Now,
DateTime.Now.AddMinutes(120),
true,
userData);
string encTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
faCookie.Expires = authTicket.Expiration;
Response.Cookies.Add(faCookie);
我然後重定向到一個控制器/動作具有Authrize屬性:
[Authorize]
public class ProductsController : Controller
{
我已在web.config中如下:
<authentication mode="Forms">
<forms loginUrl="~/Home/Unauthorized" timeout="2880" />
</authentication>
<sessionState timeout="120"></sessionState>
但是用戶抱怨會話超時或再在幾分鐘不活動之後指導家庭/未經授權。
什麼可能導致這種情況,我應該檢查什麼?
我不明白爲什麼人們獲取與窗體身份驗證Cookie超時和服務器會話timeout..they困惑是2個不同的thinngs ...伴侶你說你的服務器 – Shaz 2014-10-13 10:57:36
到期用戶時間120分鐘,並在另一方面告訴瀏覽器cookie持有2280的身份驗證票證...顯然,票據在120後過期並且用戶超時...而用戶仍然持有以前的身份驗證票證。 – Shaz 2014-10-13 10:58:42
您是否明確定義了您的網絡中的MachineKey?配置? – Tommy 2014-10-13 16:46:38