.NET 2.0 OpenLDAP client with TLS issues

Last post 12-18-2007 7:49 AM by fiorebat. 0 replies.

Sort Posts:

  • .NET 2.0 OpenLDAP client with TLS issues

    12-18-2007, 7:49 AM
    • Loading...
    • fiorebat
    • Joined on 04-26-2007, 6:49 AM
    • Posts 3

    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?!

     

     

Page 1 of 1 (1 items)
Microsoft Communities
Page view counter