我在 asp.net mvc 中创建一个 Web 应用程序,它使用表单身份验证来验证用户身份。我正在使用 HTTP 代理工具“burp”来捕获经过身份验证的用户身份验证的 cookie。之后,我从应用程序中注销。现在我正在使用捕获的经过身份验证的 cookie 向我的服务器发送请求,并且服务器将请求视为经过身份验证的请求(即使该用户从我的浏览器中注销)。谁能让我知道我的注销代码哪里出错了?
以下是我的应用程序注销代码
public virtual ActionResult LogOff()
{
FormsAuthentication.SignOut();
Session.Abandon();
// clear authentication cookie
HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");
cookie1.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(cookie1);
// clear session cookie
HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", "");
cookie2.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(cookie2);
HttpCookie cookie3 = new HttpCookie("__RequestVerificationToken", "");
cookie3.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(cookie3);
HttpCookie cookie4 = new HttpCookie(".ASPXAUTH", "");
cookie4.Expires = DateTime.Now.AddYears(-1);
Response.Cookies.Add(cookie4);
return RedirectToAction(MVC.Account.Login());
}
下面是 burp 工具发送经过身份验证的请求并给出成功响应的屏幕截图