查询活动目录以获取 .NET 中的用户角色

1

本文介绍了查询活动目录以获取 .NET 中的用户角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我一直在使用 Linq to Active Directory,但我发现很难获得用户所属的所有角色.我可以检索它们的直接组的列表,但它不是递归的.

I have been using Linq to Active Directory a bit but I am finding it difficult to get a list of all roles of which the user is a member. I can retrieve a list of their immediate groups but it isn't recursive.

我尝试查询 AD 目录的原因是为了解决内置的角色管理器 AspNetWindowsTokenRoleProvider,除非用户名与当前的 Windows 标识匹配,否则它不会让您调用 Roles.GetRolesForUser(username).

The reason I am trying to query AD directory is to work around the built-in Role Manager AspNetWindowsTokenRoleProvider which won't let you call Roles.GetRolesForUser(username) unless the username matches the current Windows Identity.

推荐答案

你看过这个?

这篇关于查询活动目录以获取 .NET 中的用户角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14

函数委托与函数
Func Delegate vs Function(函数委托与函数)...
2023-11-11 C#/.NET开发问题
6

具有未知类型的 CreateDelegate
CreateDelegate with unknown types(具有未知类型的 CreateDelegate)...
2023-11-11 C#/.NET开发问题
5