Cross Domain Cookies With FormsAuthentication

前端 未结 3 644
野趣味
野趣味 2020-12-28 21:38

I know the security risk associated and have brought it up with the business, but they want to have their 5 domains to share the login cookie.

We are using and have

3条回答
  •  既然无缘
    2020-12-28 22:02

    You may setup all these domains as sub-domains for your company:

    www.company.com
    shop.company.com
    sales.company.com
    research.company.com
    ..
    

    then you will be able to set cookie to the parent domain and it will be visible for all sub-domains.

    var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
    cookie.Domain = ".company.com";
    Repsonse.Cookies.Add(cookie);
    

    Regards, Max Chernyshov http://prontocoder.com

提交回复
热议问题