#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2003
    Posts
    3
    Rep Power
    0

    Question How do you destroy cookies?


    Probably not a very challenging question, but how the @#$% do you destroy a cookie?

    I've tried:

    response.cookie("Cookie") = nothing
    response.cookie.remove("Cookie")

    and a host of others!

    Any help will be appreciated.
  2. #2
  3. Contributing User
    ASP Adventurer (500 - 999 posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    633
    Rep Power
    12
    You have to expire them. You can also create session cookies. These cookies will destroy themselves when the session ends. In classic ASP, there is a "expires" property.

    Hope this helps,
    Danny
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Aug 2003
    Posts
    1
    Rep Power
    0

    Try this...


    I've been having the same problem, and I almost went mad! Here's what finally worked for me:

    Use Response.AppendCookie() to add a cookie with the same name as the cookie that you want to remove, and an expiration date that is in the past. For example (in C#):

    HttpCookie objCookie= new HttpCookie("CookieName");
    objCookie.Expires = DateTime.Today.AddYears(-1);
    Response.AppendCookie(objCookie);

    I was trying this same thing with the Response.Cookies.Add() method, and it seems like it used to work, but it doesn't now, so I've switched over to this way.

    Hope this helps!
    Corey

Similar Threads

  1. how to write cookies... IE6
    By jackdavis in forum ASP Development
    Replies: 3
    Last Post: March 7th, 2003, 08:37 AM
  2. Replies: 0
    Last Post: July 29th, 2002, 01:23 PM
  3. How to check cookies?
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: November 27th, 2001, 09:21 AM
  4. Sessions and javascript cookies
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: May 11th, 2000, 07:07 AM
  5. cookies concept problem
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: May 8th, 2000, 02:42 AM

IMN logo majestic logo threadwatch logo seochat tools logo