LDAPS connection with ASP.Net/C#

0

I have a connection string for LDAP protocol

ldap://ldap.example.com:636/DC=users,DC=buyers

which works fine.

But I need to use a LDAPS connection :

ldaps://ldap.example.com/DC=users,DC=buyers

which does show up in ldp.exe windows form when I test the connection.

Unfotunately it does not work in the Asp.Net application. I get "Unknown error (0x80005000)".

I am not sure whether LDAPS string is even possible with Asp.Net. I downloaded the source code into LDAPConnection.cs class and was unable to find any valuable information.

c#
asp.net
ssl
active-directory
ldap
asked on Stack Overflow May 26, 2017 by DotNetJ • edited May 26, 2017 by Rom Eh

1 Answer

0

The method you found that works is indeed using LDAPS:

ldap://ldap.example.com:636/DC=users,DC=buyers

That's the only way to do it. I do that in one of my existing projects. It doesn't understand "LDAPS://".

If you don't believe me :) fire up Wireshark as you debug. When it connects, you'll see the SSL handshake to your domain controller.

Port 636 is only for LDAPS. Port 389 is the non-SSL port.

If you have more than one domain, you can use port 3269 for the global catalog via SSL.

answered on Stack Overflow May 27, 2017 by Gabriel Luci

User contributions licensed under CC BY-SA 3.0