title: Accessing the LDAP with PrincipalContext to a public server
body: <p>I am having issues connecting to a public LDAP using <code>PrincipalContext</code>. I can get directory entry working fine:</p>
  
  <pre><code>string sDomain = "LDAP://ldap.itd.umich.edu:389";
  string sDefaultOU = "ou=System Groups,ou=Groups,dc=umich,dc=edu";
  string sServiceUser = "cn=Directory Manager,o=University of Michigan,c=us";
  string sServicePassword = "";
  
  DirectoryEntry de = new DirectoryEntry(sDomain + "/" + sDefaultOU, sServiceUser, sServicePassword, AuthenticationTypes.ServerBind);
  DirectorySearcher ds = new DirectorySearcher(de);
  SearchResult sr = ds.FindOne();
  </code></pre>
  
  <p>But when I try to do the same thing with <code>PrincipalContext</code> I get a null reference error:</p>
  
  <pre><code>sDomain = "ldap.itd.umich.edu";
  PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, sDomain, sDefaultOU, sServiceUser, "");
  </code></pre>
  
  <p>Any ideas what I am doing wrong?</p>