2

I am attempting to connect to a LDAP server and do some searches. I am using LdapConnection and NetworkCredential objects to do this. Here is a sample of my code. When I attempt to do the Bind, I get an error that states

"The supplied credential is invalid."

I think my problem is I am not passing an expected value of Domain correctly. This is my first time programming using these objects, and I have struggled to find an example that works for me. Any help you can provide would be greatly appreciated!

string myServerName = "111.22.333.444:389";

string myUserName = "MyLogin,ou=Systems,ou=LOCATION,o=Internal,dc=MYCOMPANY,dc=COM";

string myPassword = "MyPassword";

string myDomain = "ou=Systems,ou=LOCATION,o=Internal,dc=MYCOMPANY,dc=COM";

LdapConnection myConnection = new LdapConnection(myServerName);

NetworkCredetial myCredential = new NetworkCredential(myUserName, myPassword, myDomain);

myConnection.Bind(myCredential);
csharpbd
  • 3,786
  • 4
  • 23
  • 32
BH_300
  • 21
  • 1
  • 3
  • There are several values here that are incorrect. Please check out this answer http://stackoverflow.com/questions/14813452/connect-to-active-directory-via-ldap – Gary Apr 03 '17 at 21:21

0 Answers0