Forum Moderators: open

Message Too Old, No Replies

Cookie handling

Arrgg

         

volatilegx

1:45 pm on Aug 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a cookie that is set in the home directory of a website. It is accessable from subdirectories, however when I try to change the value of that cookie from a page in a subdirectory, I get a NEW cookie, even when I use the same cookie name. I've really been pulling my hair out over this one. Is there a way to do it?

My only solution so far has been to redirect the user to a page in the home directory which changes the value of the cookie, then send them back to the page in the subdirectory... very messy.

Dan

tedster

7:56 pm on Aug 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you talking about a true sub-directory here, e.g. www.example.com/directoryname/? If so, I'm also confused.

If you are talking about a subdomain, e.g. name.example.com, then the solution should be to set the domain in the original cookie as .example.com -- rather than www.domain.com

volatilegx

5:12 pm on Sep 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm talking about a true subdirectory, not a subdomain.

adamas

8:58 am on Sep 16, 2003 (gmt 0)

10+ Year Member



Are you explicitly setting the path for which the cookie is valid? The default value is the current directory for the page setting the cookie. Presumably this would mean in your case that the two cookies should be separate, one for the root directory and one for the subdirectory.