ASP.NET 能否设置跨domain的Cookie
如下所示,如果不设置Cookie的domain(默认Cookiedomian就为localhost),服务器添加Cookie后,客户端IE的确多了个domain为localhost的Cookie
HttpCookie hc = new HttpCookie("C", "VC");
hc.Expires = DateTime.Now.AddHours(2);
//hc.Domain = "www.163.com";
Response.Cookies.Add(hc);
Label1.Text = Request.Cookies.Count.ToString();
HttpCookie hc = new HttpCookie("D", "VD");
hc.Expires = DateTime.Now.AddHours(2);
hc.Domain = "www.163.com";
Response.Cookies.Add(hc);
Label1.Text = Request.Cookies.Count.ToString();