title: ADAM authentication - howto?
body: <p>I'm attempting to authenticate a user against ADAM using a user I created in ADAM.  However, regardless of the password used (correct, or incorrect), my search comes back with a valid DirectoryEntry object.  I would assume that if the password is invalid, then the search would come back with a null object.  Are my assumptions wrong or is there a flaw in the code below?</p>
  
  <pre><code>DirectoryEntry de = new DirectoryEntry("LDAP://localhost:389/cn=Groups,cn=XXX,cn=YYY,dc=ZZZ");
  DirectorySearcher deSearch = new DirectorySearcher();
  deSearch.SearchRoot = de;
  deSearch.Filter = "(&amp;(objectClass=user) (cn=" + userId + "))";
  SearchResultCollection results = deSearch.FindAll();
  if (results.Count &gt; 0)
  {
      DirectoryEntry d = new DirectoryEntry(results[0].Path, userId, password);
          if (d != null)
          DoSomething();
  
  }
  </code></pre>