I am trying to set a cookie for domain b.com
, but the page which is setting the cookie is on a.com
the code is as below
HttpCookie myCookie = new HttpCookie("UserSettings");
myCookie["Font"] = "Arial";
myCookie["Color"] = "Blue";
myCookie.Expires = DateTime.Now.AddDays(1d);
myCookie.domain = "b.com";
myCookie.path ="/";
Response.Cookies.Add(myCookie);
I'm pretty sure this part of the code is working as I am able to do a request.cookies
to get the values. However, it is not really set on my browser. When I open a browser (such as Chrome and Firefox) and view all the cookies, then search for domain "b.com
", nothing is found! Is the cookie is not really set? I tried all night to figure this out but I can't. What am I doing wrong?