views:

1141

answers:

3

I've followed the ADAM Step by Step Guide from Microsoft and setup an ADAM instance on my local machine. I'm attempting to authenticate using the "Mary Baker" account, but every time I get a COM exception on the if (entry.Guid != null) line below. The exception states that there's an unknown user name or bad password.

However, I can use the ldp utility to connect to ADAM and successfully perform a simple bind - so I know that the user name both exists, and I have the correct password.

Additionally, I have set the msDS-UserAccountDisabled property on the user to false, and added the user to both the Administrators and Readers roles.

Any thoughts?

    path = "LDAP://localhost:50000/O=Microsoft,c=US";
    userId = "CN=Mary Baker,OU=ADAM users,";
    password = "Mary@101";

    DirectoryEntry entry = new DirectoryEntry(path, userId, password, AuthenticationTypes.None);
    if (entry.Guid != null)
        LoadWelcomeScreen();

Thanks.

+1  A: 

Hi, my name is ADAM, and I do not approve this authentication.

(lol, sorry, had to do it)

Adam
A: 

I haven't used ADAM or System.DirectoryServices, but I do have experience with LDAP and AD; hopefully the following is applicable.

I've never seen a user ID given in that format before. (It looks like some sort of relative DN, as indicated by the trailing comma?) Have you tried specifying the user ID as a full DN (as required by standard LDAP) or as a bare username (if ADAM supports that)?

When diagnosing network protocol problems like this (seeing if the my program is doing what I think I'm telling it to do and seeing how what it's doing compares to what a functioning program is doing), I've found it helpful to run Wireshark for both the non-functioning and the functioning operation to see how they differ. If you've never used Wireshark, it hopefully won't be too hard to get started:

  1. Download, install, and start the software.
  2. Under Capture, click Options.
  3. Set Interface to either localhost / loopback or to your Ethernet interface. (I don't think that loopback works as expected on Windows ; you'll probably want to pick your Ethernet interface and update your LDAP URL in your C# code to use your hostname rather than localhost.)
  4. Under Capture Filter, enter "tcp port 50000" (no quotes).
  5. Click Start, run your connect operation, then go under the Capture menu and click Stop.

Wireshark can analyze the protocol for you, so you don't have to be too familiar with the protocol details yourself, although the more you know, the easier it is to interpret all of the details. You can fire up a couple of instances of Wireshark to easily compare two different captures (your code and LDP).

Josh Kelley
A: 

I get the same error, did you ever manage to resolve this?

samcooper11
No, sorry. Project was canceled and I stopped all work on this.