在我的應用程序已經使用Asp.Net窗體身份驗證,Asp.Net認證(獲得自動註銷)
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
adminResult.UserName,
DateTime.Now,
DateTime.Now.AddDays(2),
true,
"Administrator",
FormsAuthentication.FormsCookiePath
);
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie coockie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
if (ticket.IsPersistent)
{
coockie.Expires = ticket.Expiration;
}
Response.Cookies.Add(coockie);
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction("Dashboard", "Cockpit");
}
但它會自動註銷越來越在10到15秒。
會是什麼解決方案?
感謝
請分享你的web.config細節 – Yasser
<形式名稱=「FXLWeb.ASPXAUTH 「loginUrl =」Home「protection =」All「path =」/「Cookieless =」UseCookies「slidingExpiration =」false「/> –