Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: How do you destroy cookies?

Results 1 to 3 of 3
Share This Thread →
  1. #1
    chimpy is offline Registered User
    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
    dcarva's Avatar
    dcarva is offline Contributing User
    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

  3. #3
    coreyrickards is offline Registered User
    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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates