Sharing ASP.NET cookies across sub-domains

前端 未结 4 1965
野趣味
野趣味 2020-12-01 03:47

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

4条回答
  •  不知归路
    2020-12-01 04:11

    If you're using Forms authentication on all of your sub domains, all you need to do is to add domain=".mydomain.com" property to the node in your web.config

    Note the leading period in .mydomain.com

    This simple change by itself will make your authentication cookie valid in all sub-domains; no need to manually set any cookies.

提交回复
热议问题