System.Web.HttpContext.Current.Session.Clear();
System.Web.HttpContext.Current.Session.Abandon();
System.Web.HttpContext.Current.Response.Cookies.Add(new HttpCookie("SessionId", ""));
HttpCookie aCookie;
string cookieName;
int limit = Request.Cookies.Count;
for (int i = 0; i < limit; i++)
{
cookieName = Request.Cookies[i].Name;
aCookie = new HttpCookie(cookieName);
aCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(aCookie);
}
这是我的代码,将使旧的会话ID失效。但是,浏览器不会过期/删除旧的cookie,并允许重用旧的会话ID。有什么建议吗?