我正在尝试将表单身份验证从根应用程序共享到在虚拟目录中运行的子应用程序。我在子站点中进行身份验证时遇到问题。
在父应用程序中,一切都按预期工作。
我有以下设置:
家长申请:
- 网址:
http://localhost:1336/
<forms loginUrl="~/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />
虚拟目录:
- 网址:
http://localhost:1336/subsite
<forms loginUrl="/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />
当我尝试时,http://localhost:1336/subsite
我得到以下流程:
- GET for
http://localhost:1336/subsite
-> 302 to /account/sign-in?ReturnUrl=%2fsubsite (看起来不错) - 输入用户/密码
- POST到
http://localhost:1336/account/sign-in?ReturnUrl=%2fsubsite
-> 302 /subsite (授权看起来很成功) - GET for
http://localhost:1336/subsite
-> 302 to /account/sign-in?ReturnUrl=%2fsubsite (即子网站认为它没有经过身份验证)
我也可以在浏览器的列表中看到 cookie(所以它确实在那里)
我的配置有什么问题阻止我的子站点共享父 cookie?
我在 IISExpress 上运行它