Friday, March 23, 2012

Setting Cookies on Local Site

A quick tip for setting up cookies on a site you're running locally.  If you are going to explicitly set a domain property for your cookie, the domain should be ".[domain name].[domain extension]".  This means your local site needs to have a ".[domain extension]", or your cookie won't set in IE and Chrome (surprisingly, FF cookies seem to set OK on local sites without a domain extension).

An example.  If your local site address is "http://mylocalsite", you need to first adjust that to something like "http://mylocalsite.local".  Once this is done, the domain property on your cookie should be set to ".mylocalsite.local"

No comments:

Post a Comment