내가 개발 한 응용 프로그램 (ASP.Net 4/C#)은 FormsAuthentication.RedirectToLoginPage()를 사용하여 클릭 한 후 사용자를 로그인 페이지로 다시 보냅니다. 로그 아웃 버튼.FormsAuthentication.RedirectToLoginPage가 사이트의 루트에서 응용 프로그램이 작동하지 않을 때
IIS 사이트의 루트에 응용 프로그램을 배포하면 리디렉션이 작동하지 않습니다. 로그 아웃 버튼을 클릭하면 페이지가 다시로드됩니다.
응용 프로그램을 사이트 내의 응용 프로그램 가상 폴더에 배포하면 리디렉션이 작동합니다.
또한 응답하지 않는 Respond.Redirect()를 사용했는데 작동하지 않습니다. 사이트를 처음부터 다시 만들려고했습니다 (행운이 없음).
업데이트 : 다른 컴퓨터에서이 동작을 확인할 수 있었으므로 하나의 웹 서버가 아닌 것으로 확신합니다.
로그 아웃 버튼의 코드 : 도움을
이protected void lbLogout_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Session.Abandon();
// clear authentication cookie
HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");
cookie1.Expires = DateTime.Now.AddYears(-1);
cookie1.Path = FormsAuthentication.FormsCookiePath;
cookie1.HttpOnly = true;
Response.Cookies.Add(cookie1);
// clear session cookie
HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", "");
cookie2.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(cookie2);
FormsAuthentication.RedirectToLoginPage();
//Response.Redirect("~/login.aspx");
Response.End();
}
감사합니다!
web.config authentication> forms 노드의 loginurl 속성에는 무엇이 있습니까? – Hardrada
@Hardrada : 내 web.config 인증 및 권한 블록 : ' authentication> authorization> –
Wes