i'm tring to browse an OpenLDAP server with (ASP) .NET 2.0 encrypted with TLS.
I followed
instructions and my code is:
using System.DirectoryServices.Protocols;
public string ldapAuth()
{
string domainNameandPort = "ldap.server.com"; //i tested with ldap.server.com:389
string userName = "cn=user,ou=private_data,ou=performers,ou=applications,dc=server,dc=com";
string password = "password";
// establish a connection to the directory
LdapConnection connection = new LdapConnection(domainNameandPort);
NetworkCredential credential =
new NetworkCredential(userName, password);
connection.Credential = credential;
connection.AuthType = AuthType.Basic;
LdapSessionOptions options = connection.SessionOptions;
options.ProtocolVersion = 3;
options.SecureSocketLayer=false;
string messages ="";
try
{
options.StartTransportLayerSecurity(null);
messages += "TLS started.";
}
catch (Exception e)
{
messages += "Start TLS failed with " + e.Message;
}
try
{
connection.Bind();
messages += "Bind succeeded using basic " +
"authentication and TLS.";
}
catch (LdapException e)
{
messages += e.Message;
}
try
{
options.StopTransportLayerSecurity();
messages += "Stop TLS succeeded";
}
catch (Exception e)
{
messages +="Stop TLS failed with "+e.Message;
}
return messages;
}
I receive exceptions on StartTransportLayerSecurity(null) something like* "operation not allowed error"
then i receive an exception "server not avaiable"
(* i have Italian framework, don't know precise english diciture)
I tried Novell libraries too.. (and other that i don't mention)
i found only this http://www.eggheadcafe.com/software/aspnet/31311857/systemdirectoryservices.aspx article, it seems my problem
Any suggestion?!