By default, cookies are associated with the current domain.
So if the site
www.foo.com
and you do the following:
HttpCookie appCookie = new HttpCookie("AppCookie"); appCookie.Value = "written " + DateTime.Now.ToString(); appCookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(appCookie);
The domain will be
www.foo.com
.
However, you can override this functionality by setting the domain scope:
Response.Cookies["AppCookie"].Domain = "bar.foo.com";
Then the cookie will be available only for requests in this particular subdomain.
So, you can set the Domain to NULL, but I cannot imagine a scenario where this would be useful.
Check how you create cookies.
Link: http://msdn.microsoft.com/en-us/library/ms178194.aspx
RPM1984
source share