I just get this to work, do this:
1. Create 2 files, coo1.asp and coo2.asp
2. coo1.asp goes into your www.yourdomain.com root
3. coo2.asp goes into your sub.yourdomain.com root
Here's the files for you to copy paste:
<%
'// File 1 - coo1.asp
Response.Cookies("cook") = "Pass me along please!"
Response.Cookies("cook").Domain = ".yourdomain.com"
Response.Write("Cookie set: [ " & Request.Cookies("cook") & " ]")
%> |
<%
'// File 2 - coo2.asp
Response.Write("Cookie retrieved: [ " & Request.Cookies("cook") & " ]")
%> |
Now open 2 browser windows;
1. On the first one go to [www.yourdomain.com/coo1.asp] make sure it reports cookie set.
2. On the second one, go to [sub.yourdomain.com/coo2.asp] make sure it returns the value of the cookie.
Make sure you change [yourdomain.com] to your actual domain in the code and URLs posted above.
This example works only when sharing stuff between sub-domains part of the same domain not between different domains.
I have encounter a problem when testing this in IE, maybe because of the high security settings I have here, but when testing on Firefox, it worked nicely, so if this don't work for you, could be because you browser is either blocking cookies or not allowing some kinds of it.