【发布时间】:2018-07-31 22:11:33
【问题描述】:
在对我们的系统进行渗透测试后,有人指出,当用户注销时,该用户会话仍然处于活动状态,尽管 cookie 已被删除。我已通过复制 .AspNet.ApplicationCookie 值确认了这一点,并向 Postman 的其他受限站点发出了请求。在调试时,我可以看到即使在我放弃会话之后,会话仍然使用 ID。
这是我目前的注销方法:
public ActionResult LogOff()
{
HttpContext.Response.Cache.SetAllowResponseInBrowserHistory(false);
HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
HttpContext.Session.Clear();
HttpContext.Session.Abandon();
HttpContext.Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
return RedirectToAction("Index", "Home");
}
我想知道这是 Identity 或 MVC 中的错误,还是我遗漏了什么?
我将 Identity 2.2.1 与 Entity Framework 6 和 MVC 5 一起使用
【问题讨论】:
标签: c# session asp.net-mvc-5 asp.net-identity-2