I am using the following code to set a session cookie
HttpCookie cookie = new HttpCookie("visitId");
cookie.Value = value;
cookie.Domain = ".example.com";
Response.Cookies.Set(cookie);
This works fine, although I was surprised to see in IE8 when I hit F12 (developer tools) and then 'Cache > View Cookie Information' I get the following. It says '.com' instead of 'example.com'
NAME visitId
VALUE 1472215
DOMAIN .com
PATH /
EXPIRES At the end of the Session
The HTTP header sent says this :
Set-Cookie: visitId=1472215; domain=.example.com; path=/
Whats going on? Why is IE8 showing only .com for the domain? Is this just the way session cookies work. That doesnt make sense of course.
What was interesting to me is that a persistent cookie shows this, when set using the same code.
NAME userGUID
VALUE e1cbe4f3-6300-44e1-a702-b449d5711816
DOMAIN example.com
PATH /
EXPIRES 3/27/2010 1:05:14 AM
Am I misunderstanding something or is this just a bug in their 'cookie' display logic?
I've verified at least that it isn't sending the cookies to stackoverflow.com :-)