开发者

fastest way to query data from active directory

开发者 https://www.devze.com 2023-02-25 17:56 出处:网络
I\'m trying to query \"member-of\" data about a user and I\'m looking for the fastest way to do so in C#.

I'm trying to query "member-of" data about a user and I'm looking for the fastest way to do so in C#.

I've tried IsInRole(), PrincipalSearcher and linq and the results where far better for the IsInRole method.

Still from w开发者_开发百科hat I've heard, an LDAP query of some sort has to be faster then multiple IsInRole callings, I just can't find one.

if anyone has the fastest way (or even faster then the IsInRole() method) to get this information from the AD, please help me.

thanks, Matt


A possible alternative to IsInRole is checking if a user is member of a group with a DirectorySearcher, using this ldap filter (check search filter syntax):

"(memberOf:1.2.840.113556.1.4.1941:=CN=SomeGroup,DC=X,DC=Y)"

Also, you must specify the user as search base.
I don't know, however, if performance-wise this is better than IsInRole...

0

精彩评论

暂无评论...
验证码 换一张
取 消