0

I am using the following code to do LDAP authentication

   PrincipalContext _loginContext = new PrincipalContext(ContextType.Domain, "mydomain.com");
_isAuthSuccess = _loginContext.ValidateCredentials(myUserName, myPassword);
if (_isAuthSuccess)
{
//assume the validation is OK 
}

This code is working fine and i am able to decide the user is authenticated or not.

But now i have to find the user belongs to a particular user group (active directory user group ) and if its , then only allow login . So how can i find the user belongs to what all groups in C#

Sebastian
  • 4,625
  • 17
  • 76
  • 145
  • Possible duplicate of [Get List of Users From Active Directory In A Given AD Group](https://stackoverflow.com/questions/513124/get-list-of-users-from-active-directory-in-a-given-ad-group) – Mojtaba Tajik Sep 10 '18 at 04:39
  • 1
    Possible duplicate of [How to get all the AD groups for a particular user?](https://stackoverflow.com/questions/4460558/how-to-get-all-the-ad-groups-for-a-particular-user) – Am_I_Helpful Sep 10 '18 at 07:39

0 Answers0