跨子域的asp.net表单身份验证
这应该很简单,但我不知道我错过了什么。
我正在跨子域使用表单身份验证,
我有一个父域 parent.com
和两个子域 portal.parent.com
和 auth.parent.com
。 auth.parent.com
是身份验证站点。
当未授权用户访问portal.parent.com/site
时,他们将被重定向到auth.parent.com/Account/LogOn?ReturnUrl=%2fsite
,成功后登录时他们被重定向到auth.parent.com/site
,这就是问题所在。我原以为会被重定向回 portal.parent.com/site
。
上的配置
我在两个网站portal.parent.com/site
web.config
<authentication mode="Forms">
<forms loginUrl="http://auth.parent.com/Account/LogOn" enableCrossAppRedirects="true" domain=".parent.com" timeout="2880" />
</authentication>
auth.parent.com/site
web.config
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" enableCrossAppRedirects="true" domain=".parent.com" timeout="2880" />
</authentication>
(返回网址除外),身份验证工作正常,即如果我返回portal.parent.com/site
我可以看到用户已通过身份验证,并且我可以访问身份信息。
我正在阅读这个问题 跨子域的表单身份验证
但对我的情况没有特别帮助。
谢谢
This should be simple but i dont know what i am missing.
I am using forms authentication across sub domains,
I have a parent domain, parent.com
and two sub domains portal.parent.com
and auth.parent.com
. auth.parent.com
is the authenticating site.
When an unautherized users access portal.parent.com/site
, They will be redirected to auth.parent.com/Account/LogOn?ReturnUrl=%2fsite
, after a successfull login they are redirected toauth.parent.com/site
, and that the problem. I was expecting to be redirected back to portal.parent.com/site
.
my configuration on boths sites
portal.parent.com/site
web.config
<authentication mode="Forms">
<forms loginUrl="http://auth.parent.com/Account/LogOn" enableCrossAppRedirects="true" domain=".parent.com" timeout="2880" />
</authentication>
auth.parent.com/site
web.config
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" enableCrossAppRedirects="true" domain=".parent.com" timeout="2880" />
</authentication>
other than the return url, the authentication is working fine, i.e If i go back to portal.parent.com/site
I can see the user authenticated and i can access the Identity info.
I was reading this question Forms Authentication across Sub-Domains
But didnt help specifically in my case.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我得到了这个 用于单点登录的表单身份验证 ReturnUrl 和子域< /a>
,这解决了我的问题。
不过,我不确定这是否是最好的方法。
I got this Forms Authentication ReturnUrl and subdomain for single sign-on
, That solved my problem.
I am not sure if that is the best way to do it, though.