HttpContext.Current.User.IsInRole() 授权问题

发布于 2024-10-04 04:56:21 字数 222 浏览 5 评论 0原文

我在通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

疯狂的代价 2024-10-11 04:56:21

不,不是这样 - 如果您正在寻找 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.

走过海棠暮 2024-10-11 04:56:21

我认为我的问题可以通过以下方法之一解决:

  1. 我重置 IIS。
  2. 我删除了机器上的cookie。

奇迹般的是,它奏效了。感谢您的回复 AviD。

I think my issue is resolved by one of the below ways:

  1. I reset my IIS.
  2. I deleted my cookies on the machine.

Miraculously, it worked. Thanks for your responses AviD.

橘味果▽酱 2024-10-11 04:56:21

我确实遇到了类似的问题,经过几个小时的调试后,我通过在更改活动目录中的组后注销并在客户端登录来解决它。

我不必重新启动 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文