I need a way to see if a user is part of an active directory group from my .Net 3.5 asp.net c# application.
I am using the standard ldap authentication example off of msdn but I don't really see how to check against a group.
I need a way to see if a user is part of an active directory group from my .Net 3.5 asp.net c# application.
I am using the standard ldap authentication example off of msdn but I don't really see how to check against a group.
With 3.5 and System.DirectoryServices.AccountManagement this is a bit cleaner:
The code below will work in .net 4.0
Here is my 2 cents.
You could try the following code:
If you want to check the user groups membership including the nested groups which is indirectly linked to the user parent group you can try use the "tokenGroups" properties as below:
How about this
How to write LDAP query to test if user is member of a group?