title: LDAP DirectoryEntry unable to connect via hostname but only via IP address
body: <p>When I'm trying to connect to an AD in my computer network by writing the following line:</p>
  
  <pre><code>DirectoryEntry de = new DirectoryEntry("LDAP://hostname.local");
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>Logon failure: unknown user name or bad password</p>
  </blockquote>
  
  <p>But when I'm trying to connect to the same computer using its IP I'm able to reach the computer without an error, that is the following line does work:</p>
  
  <pre><code>DirectoryEntry de = new DirectoryEntry("LDAP://The IP of hostname.local");
  </code></pre>
  
  <p>How is it possible that when I'm trying to use the ldap query with hostname I'm getting Logon failure but when I'm using the host name ip address I reach the computer successfully and able to view its AD contents.</p>