3

How can I remove an HTTP_COOKIE cookie from the browser using classic ASP?

Keith
  • 20,636
  • 11
  • 84
  • 125
user446573
  • 71
  • 1
  • 2
  • 5

2 Answers2

5
Response.Cookies("cookie_name").Expires = DateAdd("d",-1,Now())
Keith
  • 20,636
  • 11
  • 84
  • 125
adinas
  • 4,150
  • 3
  • 37
  • 47
0

A cookie is a user's property once it is sent to his computer. you cannot actually remove it manually from his/her computer as this would lead to security flaws. So the solution is using the expire property of a cookie. For example setting the cookie's expires property to a previous or older time, ensures that the browser automatically deletes/discards the cookie. For eg:

 myCookie.Expires = DateTime.Now.AddDays(-1d);
loxxy
  • 12,990
  • 2
  • 25
  • 56