0
protected void Page_Load(object sender, EventArgs e)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
Session["User"] = "Authenticated";
Session["Username"] = HttpContext.Current.User.Identity.Name;
Response.Redirect("HomePage.aspx");
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
int recordExistCount = fc.Authenticate(txtUsername.Text.Trim(), txtPassword.Text.Trim());
if (recordExistCount == 1)
{
Session["User"] = "Authenticated";
Session["Username"] = txtUsername.Text.Trim();
fc.IsOnlineRecord(Session["Username"].ToString(),true);
var ticket = new FormsAuthenticationTicket(2,Session["username"].ToString(),DateTime.Now,DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes), true,"",FormsAuthentication.FormsCookiePath);
var encryptedTicket = FormsAuthentication.Encrypt(ticket);
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
{
HttpOnly = FormsAuthentication.RequireSSL,
Path = FormsAuthentication.FormsCookiePath,
Domain = FormsAuthentication.CookieDomain
};
Response.Cookies.Add(cookie);
Response.Redirect("HomePage.aspx");
}
<authentication mode="Forms">
<forms loginUrl="LoginPage.aspx"
protection="All"
timeout="60"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="HomePage.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false"/>
</authentication>
내 페이지가 10 분 이상 유휴 상태 일 때 내 페이지가 시간 초과됩니다. 나는 무엇이 잘못 될지 궁금해하니?FormsAuthentication 시간 초과 문제
당신이 개발하는 동안 SSL에서 실행중인 :이
점검하십시오 (system.web 요소 내에)에 sessionState의 요소에 대한 추가 정보를 원하시면이 링크를 할 수 있는가? – kd7
forms 태그의 requireSSL 속성이 false로 설정되었습니다. –
동일하거나 유사하지는 않지만 거의 비슷하게 보입니다. http://www.hanselman.com/blog/WeirdTimeoutsWithCustomASPNETFormsAuthentication.aspx – kd7