Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 12, 2011 09:56 AM by smirnov
Aug 11, 2011 08:47 PM|LINK
Does MVC provide an easy way to find out and return a list of a user's AD Group Membership?
After a users is authenticated via IIS/Integrated Auth, I want to query AD group and get a list/array of the user's AD Groups.
Aug 12, 2011 09:56 AM|LINK
Read more about System.DirectoryServices namespace and browse other threads in this forum, there are a lot of examples, similar to this:
DirectoryEntry de = new DirectoryEntry("LDAP://domain.corp:389/DC=domain,DC=corp");
DirectorySearcher ds = new DirectorySearcher(de);
ds.SearchScope = SearchScope.Subtree;
ds.Filter = "(sAMAccountName=john)"; // where john is current login (without domain)
SearchResult result = ds.FindOne();
foreach (string g in result.Properties["memberOf"])