If it was your post as Anonymonk yesterday you will already have seen the answer I gave at Re: Weird CGI Cookie Problem. This does work so if it is not working for you you will need to explain your program logic with a example of what you are doing and details of how it does not work in precise terms.

As noted in the node above to delete a cookie you simply overwrite the original with a cookie with the same name from the same domain and path that has an expiry in the past. What happens is that this new cookie info is sent to the client browser in the HTTP header. The browser parses the cookie info and then writes the new cookie. As each domain/path can only have one cookie of a given name this new cookie will overwrite the old one.

Because the browser is handling this interaction you do not have direct control over what happens. It may choose to delete the cookie immediately, perhaps store the new cookie in memory to be discarded when the browser shuts down (as happens if no expiry is specified) or do nothing if cookies have been disabled. The bottom line is that you are depending on the browser to do the deletion. If it is really vital to delete a cookie don't send it in the first place. Send an ID number cookie that references the data you want perfect deletion control over. *You store this data on the server* Then all you need do is delete the server data and let the cookie expire in it's own time.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Deleting cookies by tachyon
in thread Deleting cookies by cfreak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.