Last post Aug 12, 2011 05:56 AM by smirnov
Aug 11, 2011 04:47 PM|mresanchez40|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 05:56 AM|smirnov|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"])