title: c# check if the user member of a group?
body: <p>I have a code that I use to check if the user is member of the AD, worked perfectly,</p>
  
  <p>now I want to add the possibility to check if the user also a member of a group!</p>
  
  <p>what do I need to modify to achieve that, I did some work, but it fails!</p>
  
  <p>so here is my code:</p>
  
  <pre><code>        //Authenticate a User Against the Directory
          private bool Authenticate(string userName,string password, string domain)
          {
  
              if (userName == "" || password == "")
              {
                  return false;
              }
  
              bool authentic = false;
              try
              {
                  DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain,userName, password);
                  object nativeObject = entry.NativeObject;
                  authentic = true;
              }
              catch (DirectoryServicesCOMException) { }
              return authentic;
          }
  </code></pre>
  
  <p>I  want to make it like this:</p>
  
  <pre><code>private bool Authenticate(string userName,string password, string domain, string group)
  </code></pre>