是否有可能分享窗体身份验证*只有*跨子子域? [英] Is it possible to share forms authentication *only* across sub-sub domains?

查看:125
本文介绍了是否有可能分享窗体身份验证*只有*跨子子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以在2子域共享窗体身份验证 sub1.domain.com sub2.domain.com 通过使用以下的Web.config设置:

I know I can share forms authentication across 2 subdomains sub1.domain.com, sub2.domain.com by using the following Web.config setting:

<authentication mode="Forms">
    <forms domain="domain.com" />
</authentication>

不过,我有2个子子域(不知道是否有一个更好的术语,表示) a.sub.domain.com b.sub.domain.com 。现在,我想分享的形式验证Cookie的只有的关于 sub.domain.com 的我的整个 domain.com 。是否有可能做到这一点?

However, I have 2 "sub-sub" domains (not sure if there's a better term for that) a.sub.domain.com, and b.sub.domain.com. Now I want to share the forms authentication cookies only on sub.domain.com, and not my entire domain.com. Is it possible to do this?

我试过下面的明显的解决方案,但它不工作,始终重定向回登录页面:

I tried the obvious solution below but it doesn't work, and always redirects back to the login page:

<authentication mode="Forms">
    <forms domain="sub.domain.com" />
</authentication>

是否有可能跨越与 sub.domain.com

推荐答案

所以,事实证明,我的老cookies在我的浏览器都以某种方式与新的设置冲突。

So it turned out that my old cookies in my browser were somehow conflicting with the new setting.

清除所有 domain.com 饼干之后,我现在正在努力解决方案的工作,万一有人面临着类似的情况。

After clearing all domain.com cookies, the solution I was trying now works, in case anyone faces a similar situation.

另外请注意,我相信这是preferable至prePEND一个 域:

Also note I believe it's preferable to prepend a . to the domain:

<authentication mode="Forms">
    <forms domain=".sub.domain.com" />
</authentication>

这篇关于是否有可能分享窗体身份验证*只有*跨子子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆