I have been trying to connect to our OpenLDAP server from asp.net for the last four days without success. Just before I pull off my hair, could any one out there have a solution that has worked( ie using c# asp.net to connect to OpenLDAP server). Apparently I can access the ldap server from putty.exe and do a search. Furthermore, I can use the LDAP server for authentication using a local installation of Drupal CMS without any problems - given that I have added the LDAP module. My problem is doing the same in asp.net. The specific details are as follows:
Ldap server is hosted on sun solaries. My development machine is running Win XP Service pack 3. The error shows up when I try to call bind with a username and password that I have used successfully with putty.
string hostNameAndSSLPort = "ipaddress";
string userName = "username";
string password = "password";
// establish a connection
LdapConnection connection = new LdapConnection(hostNameAndSSLPort);
// create an LdapSessionOptions object to configure session
// settings on the connection.
LdapSessionOptions options = connection.SessionOptions;
options.ProtocolVersion = 3;
options.SecureSocketLayer = true;
connection.AuthType = AuthType.Basic;
connection.Credential =
new NetworkCredential(userName , password );
try
{
connection.Bind();
}
catch(Exception e){
lblSecurity.Text = e.Message;
}
I have even tried starting TLS using options.StartTransportLayerSecurity(null); before calling bind by the same error persists. What could I be doing wrong? Please help!!!!!!!!