0

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?

Community
  • 1
  • 1
woggles
  • 7,444
  • 12
  • 70
  • 130
  • Possible duplicate of [Can I change the FormsAuthentication cookie name?](https://stackoverflow.com/questions/6661943/can-i-change-the-formsauthentication-cookie-name) – Cœur Jul 14 '18 at 14:16

1 Answers1

2

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?

Community
  • 1
  • 1
podiluska
  • 50,950
  • 7
  • 98
  • 104