views:

44

answers:

2

If I am hitting www.foo.com and am writing some cookies there, will I have access to those cookies if I hit the same code base from www2.foo.com? Or does the cross-domain cookie security come into play with sub-domains as well?

+1  A: 

Cookies set for foo.com will be accessible by sub-domains. Sub-domain cookies are not accessible by other sub-domains.

Anton
+1  A: 

If you set a cookie's domain as .example.com, it'll be available across all subdomains. If you set the domain as www.example.com, it'll only be accessible to the www subdomain.

ceejayoz