mercredi 16 décembre 2015

Return a list of all Active Directory groups a user belongs to in string[ ]

I need to return all Active Directory groups a user belongs to but in string[ ], so I can use the result in Generic Principal.

I am not sure if to cast results? Please help!

string[] roles = new string[] {  
helper.GetActiveDirectoryGroups(User.Identity.Name) };

GenericPrincipal principal = new GenericPrincipal(identity,roles);

 public string[] GetActiveDirectoryGroups(string userName)
    {
          //code here

    }

Aucun commentaire:

Enregistrer un commentaire