我一直在使用 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 中的用户角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
C# ADO.NET:空值和 DbNull —— 有没有更高效的语法C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有没有更高效的语法?)
如何在c#中将空值设置为int?How to set null value to int in c#?(如何在c#中将空值设置为int?)
使用 Min 或 Max 时如何处理 LINQ 中的空值?How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 时如何处理 LINQ 中的空值?)
Asp.net System.Web.HttpContext.Current.Session 在 global.asaAsp.net System.Web.HttpContext.Current.Session null in global.asax(Asp.net System.Web.HttpContext.Current.Session 在 global.asax 中为 null)
捕获的异常本身为空!Caught exception is null itself !(捕获的异常本身为空!)
为什么连接空字符串有效但调用“null.ToString()&Why is it Valid to Concatenate Null Strings but not to Call quot;null.ToString()quot;?(为什么连接空字符串有效但调用“null.ToString()无效