Eureka_sg has the right answer; you cannot do this. Given a host name such as www.mydomain.co.uk, you can set and retrieve cookies for mydomain.co.uk and www2.mydomain.co.uk but you cannot do it for www.anotherdomain.co.uk, or co.uk, etc. In other words, given a domain name of N elements, you can set/get cookies for which the 1st element varies, but none of the others. This is obviously for security reasons because cookies are private transactions between a site and you, and to be able to put cookies for another site while delivering a page opens up a whole new world for potental misuse.

(Of course, it should be noted that nasty bugs were found in Netscape because their cookie validation service assumed that all domain names were 3 parts, thus making the case above of valid cookies in www.anotherdomain.co.uk work. This was quickly squashed once discovered).


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

In reply to Re: cookies, cgi::cookie, set by domain by Masem
in thread cookies, cgi::cookie, set by domain by Anonymous Monk

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.