I am struggling trying to test my LDAP authentication using ldap.forumsys.com:389.Server specifics here: Online LDAP Test Server
Here's the code I am using to communicate with server from my c# app:
using System.DirectoryServices;string ldapServerAddress = "ldap.forumsys.com:389";string ldapBaseDN = "DC=example,DC=com";string ldapUserName = "CN=read-only-admin,DC=example,DC=com";string ldapPassword = "password";try{ using var directoryEntry = new DirectoryEntry($"LDAP://{ldapServerAddress}/{ldapBaseDN}", ldapUserName, ldapPassword); directoryEntry.RefreshCache(); }catch (Exception ex){ Console.WriteLine($"Exception caught: {ex.Message}");}
Each time this code is run, it encounters "An invalid dn syntax has been specified." exception.
I've already tried a lot of different variations to connection parameters, like uppercase "DN" instad of lowercase, "read-only-admin@example.com" instead of "CN=read-only-admin,DC=example,DC=com" etc. Nothing seems to work though.
I am 100% sure the server works, I've connected to it via Apache Directory Studio and accessed its resources with no problem. I've also tried using DNs copied from ADS but that did not work either.
What am I doing wrong?