firefox lead dot in cookie issue

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-03-23T11:38:35Z Indexed on 2010/03/23 11:43 UTC
Read the original article Hit count: 312

Filed under:
|

Hi all,

We are having an annoying issue with Firefox and cookies. We have the following domains:

sub1.mydomain.com sub2.mydomain.com sub3.mydomain.com otherdomain.com

We have converting our framework to be multilingual and providing a drop down to change the language at any point during site.

The code base is shared across all the domains above.

We can not set a cookie across all "mydomain.com" sites, they have to be on each of the sub domains. To get this to work we set a JavaScript cookie when the users chooses a new language. When the page posts back to the server the code picks this up and sets the users preferences to that new language code, (this is all C# and ASP.NET).

We have to set the host to be "subX.mydomain.com" and the path to be "/" in the cookie so that it is just for the subdomain and all parts of that domain.

This works great on all browsers apart from FireFox. It seems that firefox will pre append a DOT to the beginning of domain so ".subX.mydomain.com".

When the code posts back with FireFox the cookie is always null.

Has anyone had this situation, (I imagine it is not al that uncommon). I have read a lot of people saying, remove the domain from the cookie, but that can not work for us as we have multiple subdomains that need their own cookie values.

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about firefox-cookie