Here's the situation:
- Website A, ASP.NET MVC 4 web application. Domain: http://a.example.com
- Website B, ASP.NET MVC 4 web applicaiton. Domain: http://b.example.com
I'm trying to share a cookie (forms authentication) between the websites.
I'm not using Forms Authentication per-se. I'm using the built-in methods (Encrypt, Decrypt, etc), but I'm setting my own custom cookie.
When I set the cookie on one of the websites, the other ones sees the cookie, but can't decrypt it. The error is the generic "Error occurred during a cryptographic operation".
What I've ensured:
- The cookie has the domain set to "example.com" (which means subdomains can access. Proof is the other website can "see" the cookie).
- Both websites share the same machine key. The web.config for both has the same value for the decryptionKey and validationKey.
- The forms authentication ticket version and cookie name are the same across both websites.
- The path is set to "/".
I've done this before and it works fine, but in that scenario both applications were sharing the same code base.
In this instance, they are separate applications. This is because i am prototyping a solution where two platform-independent applications on the same top level domain can share a authentication cookie.
Can anyone tell me what i's missing, or provide an alternative solution.
I've read all the related questions, but the answer is usually 2) above.