如何在Azure上与父级和子域共享Asp.Net身份验证Cookie

时间:2018-10-19 18:44:20

标签: asp.net-mvc asp.net-identity azure-web-sites forms-authentication

好的,这是场景。我在Azure的SAME资源组和服务计划上运行2个网站。 1是父域:http://www.thetradebutler.com,而我要共享Auth cookie的子域位于:http://lab.thetradebutler.com

以下是每个Web应用程序的详细信息:

父母

表单身份验证:

<authentication mode="Forms">
  <forms loginUrl="~/members/logon" 
         cookieless="UseCookies"
         name="thetradebutler"
         domain=".thetradebutler.com"
         slidingExpiration="true"
         timeout="432000"/>
</authentication>

子域:

表单身份验证:

<authentication mode="Forms">
  <forms loginUrl="https://www.thetradebutler.com/Members/Logon" 
         cookieless="UseCookies"
         name="thetradebutler"
         slidingExpiration="true"
         timeout="432000"/>
</authentication>

以上内容是有效的,无法正常工作。我可以在子域中看到Cookie,但是它似乎无法读取/解密它以了解用户已通过身份验证。

问题在于,它在本地有效。我在本地IIS上设置:

  • thetradebutler.local(父母)
  • lab.thetradebutler.local(子)

,并且当我将父web.config中的域更改为“ .thetradebutler.local”时,它可以工作。哪个使我认为这可能是特定于环境(天蓝色)的问题?

到目前为止我尝试过的事情:

  • 我尝试过使用和不使用前导“”。在Cookie域上。
  • 我尝试按照Shared Forms Auth cookie not working on subdomain
  • 从两个Web.configs中删除目标框架
  • 我尝试在子域形式web.config中设置以下行:domain =“。thetradebutler.com”。

任何帮助将不胜感激!

0 个答案:

没有答案