0

In my logout function, I have

HttpContext.Current.Session.Abandon();
HttpContext.Current.Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddYears(-30);

I see that the response contains set-cookie for ASP.NET_SessionId with the proper expiration, but then the browser (Chrome in this case) never actually deletes the cookie.

Jarrod Everett
  • 761
  • 2
  • 7
  • 15

1 Answers1

0

tiy can try with this code

HttpCookie myCookie = new HttpCookie("ASP.NET_SessionId");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);
Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51