HttpContext.Current.User.IsInRole() 授权问题
我在通过 HttpContext.Current.User.IsInRole("DOMAIN\\RoleName") 授权自己时遇到一个奇怪的问题。
有一个 AD 组 A,其中另一个组 B 作为成员。我是A和B的成员。然而,当我尝试为 A 和 B 授权自己时,它分别给出 false 和 true 。也就是说,对于A,它不授权我,而对于B,它授权我。即使我是父组和子组的成员,IsInRole 也只会为子组授权吗?
I am facing a strange issue while authorizing myself via HttpContext.Current.User.IsInRole("DOMAIN\\RoleName")
.
There is an AD Group A which has another group B as a member. I am a member of A and B both. However when I try to authorize myself for A and B it gives me false and true respectively. That is for A it does not authorizes me while for B it does. Is it that even if I am member of parent group and child group, the IsInRole will authorize only for child group.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,不是这样 - 如果您正在寻找 GroupA,并且是其中的成员,那么 GroupB 就无关紧要。
会不会是你拼错了?它们都在同一个域中吗?
否则请验证 GroupA 是否为安全组,否则它不会出现在您的角色中。
No, that's not it - if you're looking for GroupA, and are a member of it, GroupB is irrelevant.
Could it be you misspelled it? Are they both in the same domain?
Otherwise verify that GroupA is a security group, otherwise it wont appear in your roles.
我认为我的问题可以通过以下方法之一解决:
奇迹般的是,它奏效了。感谢您的回复 AviD。
I think my issue is resolved by one of the below ways:
Miraculously, it worked. Thanks for your responses AviD.
我确实遇到了类似的问题,经过几个小时的调试后,我通过在更改活动目录中的组后注销并在客户端登录来解决它。
我不必重新启动 iis 服务器或删除所有 cookie。
I did have a similar issue and after hours of debugging I solved it by logging off and logging with at the client after changing groups in the active directory.
I didn't have to restart the iis server or deleting all cookies.