The cookie specs require two names and a dot between, so your cookiedomain cannot be “localhost”. Here’s how I solved it:
-
Add this to your %WINDIR%\System32\drivers\etc\hosts file:
127.0.0.1 dev.livesite.com -
When developing you use http://dev.livesite.com instead of http://localhost
-
Use “.livesite.com” as cookiedomain (with a dot in the beginning) when creating the cookie.
Modern browsers doesn’t require a leading dot anymore, but you may want to use anyway for backwards compability. -
Now it works on all sites:
- http://dev.livesite.com
- http://www.livesite.com
- http://livesite.com