I have two sites, both on the same domain, but with different sub-domains.
site1.mydomain.com
site2.mydomain.com
Once I\'m authenticated on each, I look at the c
Add new cookie and specify domain like this
HttpCookie cookie = new HttpCookie("cookiename", "value");
cookie.Domain = "domain.com";
For forms authentication set this in web.config
The cookie will be accessible to all the subdomains.
In order for each domain to decrypt the the cookie, all web.config files must use the same encryption/decryption algorithm and key. (how to create a machine key)
Example:
// do not wrap these values like this in the web.config
// only wrapping for code visibility on SO
For easier deployments, these values can be stored in a separate file:
For added security you can also encrypt the machine key for further protection..