title: The distinguished name contains invalid syntax error
body: <p>I'm trying using LDAP to authenticate user, but I have a problem with LDAP.</p>
  
  <p>This is my code:</p>
  
  <pre><code>string hostOrDomainName = "MrHand-PC";
  string targetOu = "cn=Huy Pham,ou=people,dc=example,dc=com";
  
  // create a search filter to find all objects
  string ldapSearchFilter = "uid=pdhuy";
  
  // establish a connection to the directory
  LdapConnection connection = new LdapConnection(hostOrDomainName);
  
  Console.WriteLine("\r\nPerforming a simple search ...");
  SearchRequest searchRequest = new SearchRequest(targetOu, ldapSearchFilter, 
      System.DirectoryServices.Protocols.SearchScope.OneLevel, null);
  
  // cast the returned directory response as a SearchResponse object
  SearchResponse searchResponse =
              (SearchResponse)connection.SendRequest(searchRequest);
  </code></pre>
  
  <p>The last line throws an exception: <code>The distinguished name contains invalid syntax.</code></p>
  
  <p>Can anyone help my solve this problem?</p>