Internet Explorer ignoring the cookies

cookieshttpinternet explorerwebobjects

I am having a strange problem with Internet Explorer not accepting my cookies. This is the cookie:

set-cookie: USUSERNAME=LrceSVu6mUJ9Ztmvp4oKSQ%3D%3D; version="1"; expires=Mon, 15-Jun-2009 11:42:21 GMT; path=/; domain=.us.is

It does not get stored for the domain dev-intranet.us.is or any other us.is domain. However setting the domain of the cookie to my dev machines ip address works perfectly:

set-cookie: USUSERNAME=LrceSVu6mUJ9Ztmvp4oKSQ%3D%3D; version="1"; expires=Mon, 15-Jun-2009 08:41:58 GMT; path=/; domain=192.168.34.104

Everything works as expecten in Firefox, Opera, Safari and Chrome but not IE7

Any ideas whats going on here?

Btw. using WebObjects WOCookie to create the cookie.

Best Answer

The cookie in your example is for the "us.is" domain. IE ignores cookies set for two-letter domains. To be more exact, it seems to ignore cookies from domains with less than 5 characters (like yours: 2+2).

I remember this bug/feature from IE6 I believe, possibly earlier versions. Reading this, it looks like the behavior is still around in IE7.

An MSKB article suggesting an unpractical workaround can be found here: http://support.microsoft.com/kb/310676.

More practical is perhaps to get a longer domain name ;-) or to make sure users are always redirected to one canonical name, i.e. "www.us.is" and plant your cookies there.

Related Topic