Description
If you instantiate a LdapConnection with a string consisting from a server name and a port number e.g.
LdapConnection ldap = new LdapConnection("ldap.example.com:636");
then a later method call like
DirectoryResponse dResp = ldap.SendRequest(request);
yields
Exception has occurred: CLR/System.DirectoryServices.Protocols.LdapException
An unhandled exception of type 'System.DirectoryServices.Protocols.LdapException' occurred in System.DirectoryServices.Protocols.dll: 'A bad parameter was passed to a routine.'
at System.DirectoryServices.Protocols.LdapConnection.Connect()
at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request)
However when instantiating the LdapConnection in this manner
LdapConnection ldap = new LdapConnection(new LdapDirectoryIdentifier("ldap.example.com",636));
then same SendRequest works without exceptions.
Documentation at
.Net Documentation System_DirectoryServices_Protocols_LdapConnection__ctor_System_String_
states that
server String
A string specifying the server which can be a domain name, LDAP server name or dotted strings representing the IP address of the LDAP server. Optionally, this parameter may also include a port number, separated from the right end of the string by a colon (:).
Configuration
.Net6-rc1 Linux Ubuntu 18.04 x86-64
Regression?
Don't know.
Other information