How to delete a cookie?

Discussion in 'ASP .Net' started by Boban Dragojlovic, Jul 2, 2003.

  1. I need the statement for deleting a permanent cookie that I created
    earlier...

    The .NET documentation refers to the .discard property, but the compiler
    balks at that property

    e.g. Response.Cookies("deleteME").discard()
    Boban Dragojlovic, Jul 2, 2003
    #1
    1. Advertising

  2. There's a Remove method for the cookies collection that might work for you:

    http://msdn.microsoft.com/library/d...emwebhttpcookiecollectionclassremovetopic.asp

    MyCookieCollection.Remove(MyCookie)

    Another way to remove a cookie is to set the Expire property to a date in
    the past.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message
    news:b6JMa.344$...
    >
    > I need the statement for deleting a permanent cookie that I created
    > earlier...
    >
    > The .NET documentation refers to the .discard property, but the compiler
    > balks at that property
    >
    > e.g. Response.Cookies("deleteME").discard()
    >
    >
    >
    >
    Steve C. Orr, MCSD, Jul 2, 2003
    #2
    1. Advertising

  3. Boban Dragojlovic

    David Waz.. Guest

    I've never trusted the .remove method.
    I always expire the cookie so I know the client will have
    the expired data. I should take the time to research the
    total affect of .Remove, but setting the date to now - 1
    day works so well...
    >-----Original Message-----
    >There's a Remove method for the cookies collection that

    might work for you:
    >
    >http://msdn.microsoft.com/library/default.asp?

    url=/library/en-
    us/cpref/html/frlrfsystemwebhttpcookiecollectionclassremove
    topic.asp
    >
    >MyCookieCollection.Remove(MyCookie)
    >
    >Another way to remove a cookie is to set the Expire

    property to a date in
    >the past.
    >
    >--
    >I hope this helps,
    >Steve C. Orr, MCSD
    >http://Steve.Orr.net
    >
    >
    >"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org>

    wrote in message
    >news:b6JMa.344$...
    >>
    >> I need the statement for deleting a permanent cookie

    that I created
    >> earlier...
    >>
    >> The .NET documentation refers to the .discard property,

    but the compiler
    >> balks at that property
    >>
    >> e.g. Response.Cookies("deleteME").discard()
    >>
    >>
    >>
    >>

    >
    >
    >.
    >
    David Waz.., Jul 3, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben
    Replies:
    3
    Views:
    5,798
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. Shapper

    Cookie and Session Cookie Questions.

    Shapper, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    554
  3. =?Utf-8?B?UGF1bA==?=

    Cookie Question (IP as domain and cookie file location)

    =?Utf-8?B?UGF1bA==?=, Jan 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,463
    Bruce Barker
    Jan 10, 2006
  4. ad
    Replies:
    2
    Views:
    7,467
    Kevin Spencer
    Jan 27, 2006
  5. Phil Powell
    Replies:
    2
    Views:
    181
    Grant Wagner
    Sep 5, 2003
Loading...

Share This Page