I use 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 got into 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 sent HTTP header says the following:
Set-Cookie: visitId=1472215; domain=.example.com; path=/
What's happening? Why does IE8 only show .com for the domain? This is exactly how session cookies work. Of course, that doesn't make sense.
I was wondering what the persistent cookie shows this when it is 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
I don’t understand something or is it just a mistake in the logic of displaying a cookie?
I checked at least that it does not send cookies to stackoverflow.com :-)
source share