finding out if user used for DirectoryEntry connection is an administrator
I have an existing DirectoryEntry connection and I want to check if the user that was used for the creation of this DirectoryEntry belongs t开发者_Go百科o a specific group. anyone knows how to achieve this?
Thanks, Shuky
I don't think there's any magic, easy way to do this....
On the DirectoryEntry
object, you do have a UserName
property which should hold the name of the user that was used to create this entry, if a specific user was supplied. Using that user name, you could do a directory lookup and find that user and check whether that user belongs to the Administrators
group (or any other group) - but it's not exactly a one-liner.
精彩评论