Connect to LDAP with C#

0

I'm trying to figure out how to connect to LDAP via C#.

The only address that I've got is the following:

LDAP://CDS.mycompany.com/o=mycompany.com

I have tried to follow the following guide: https://msdn.microsoft.com/en-us/library/ms257181(v=vs.90).aspx

But they are using a <user> <pwd> <domain> for the credentials. Which is the domain?

I have also tried this:

DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://CDS.mycompany.com/o=mycompany.com");

But when I run that, I only get the following:

base {System.Runtime.InteropServices.ExternalException} = {System.Runtime.InteropServices.COMException (0x8007052E): The user name or password is incorrect.

       at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       at System.DirectoryServices.DirectoryEntry.Bind()
       at System.DirectoryServic...

What username and password is it asking for? I only want to connect to LDAP, and then just specify a username to get data about that user. No password.

c#
active-directory
ldap
asked on Stack Overflow Jan 30, 2018 by Bryan • edited Feb 16, 2019 by halfer

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0