Reputation: 7444
Possible Duplicate: Can I change the FormsAuthentication cookie name?
I have multiple MVC3 sites that create FormsAuthentication tickets and store them in cookies.
Login:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(15), true, String.Empty);
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
In Application_AuthenticateRequest:
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
Surely this will cause issues if multiple sites are saving to the same cookie? Is there any harm in having a different cookie name for each app or is there another recommended way to do it?
Upvotes: 0
Views: 1958
Reputation: 51494
It will only cause issues if those multiple sites are on the same domain.
You can set the cookie name in the web.config - see Can I change the FormsAuthentication cookie name?
Upvotes: 2