【问题标题】:With windows authentication, The trust relationship between the primary domain and the trusted domain failed, when calling IsInRole使用windows认证,调用IsInRole时主域和信任域的信任关系失败
【发布时间】:2010-04-12 21:15:28
【问题描述】:

我已将我的 asp.net Web 服务器设置为使用 Windows 身份验证。

使用我当前登录的用户进行身份验证就可以了。

我可以通过查看...来验证这一点

HttpContext.Current.User.Identity.Name

我可以通过查看来验证我是否已通过身份验证...

HttpContext.Current.User.Identity.IsAuthenticated

但是,当我调用 .IsInRole 函数时,我得到信任关系错误...

HttpContext.Current.User.IsInRole("accounting")

我在网上找到了有关使用角色名称 (domain\accounting) 提供域名的问题的在线参考资料,但我仍然遇到同样的错误。有关在何处查找或解决问题的任何建议?

【问题讨论】:

    标签: asp.net windows-authentication


    【解决方案1】:

    好吧,如果您引用了一个不存在的角色,那么您会收到受信任的域错误。

    当我从 ... 更改时,错误消失了,代码运行良好

    HttpContext.Current.User.IsInRole("accounting") 
    

    到实际的组名...

    HttpContext.Current.User.IsInRole("rsi_accounting") 
    

    【讨论】:

    • 我也遇到了这个问题。您实际上是否有多个域/林之间存在(或不存在)信任?
    • 我在同一个域中运行两台负载平衡服务器时遇到了这个问题——一个可以处理不存在的组,另一个不能!从来没有弄清楚为什么......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 2014-05-11
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    相关资源
    最近更新 更多