gpt4 book ai didi

asp.net - 使用windows认证,主域与受信域的信任关系失败,调用IsInRole时

转载 作者:行者123 更新时间:2023-12-04 14:20:35 28 4
gpt4 key购买 nike

我有我的 asp.net web 服务器设置来使用 windows 身份验证。

它对我当前登录的用户进行身份验证就好了。

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

HttpContext.Current.User.Identity.Name

我可以通过查看来验证我是否通过了身份验证...
HttpContext.Current.User.Identity.IsAuthenticated

但是,当我调用 .IsInRole 函数时,我收到了信任关系错误...
HttpContext.Current.User.IsInRole("accounting")

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

最佳答案

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

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

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

到实际的组名...
HttpContext.Current.User.IsInRole("rsi_accounting") 

关于asp.net - 使用windows认证,主域与受信域的信任关系失败,调用IsInRole时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2625509/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com