CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    140

    C# LDAP SSL connection fails

    I am using the following code to connect to aLDAP server using SSL. The following code will work only if i turn off the SSL flag. Can any one please tell me what am i missing here to do a SSL connection.

    Every time the findAll is called it is saying that

    the server is not operational

    Do i need to provide any NetworkCredentials?

    Code:
    ldapUrl="LDAP://x500.bund.de:636/l=Neutral,ou=BMI,o=Bund,c=DE";
    
    DirectoryEntry dEntry =null;
    
    // for anonymous login. x500.bund.de supports this.
    dEntry = new DirectoryEntry(ldapUrl, null, null, 
                AuthenticationTypes.SecureSocketsLayer | AuthenticationTypes.Secure); 
    
    DirectorySearcher search = new DirectorySearcher(dEntry);
    
    search.Filter = "((objectClass=*))";    
    search.Filter = searchQuery;
    SearchResultCollection scl = search.FindAll();

  2. #2
    Join Date
    Feb 2000
    Location
    OH - USA
    Posts
    1,892

    Arrow Re: C# LDAP SSL connection fails

    That's usually a certificate issue.

    Check the system event log on the client machine and see if there are any ssl/schannel errors.

    In case these errors are being suppressed: Make sure that the certificate matches everything you're expecting. Host name, expiration, etc.
    Good Luck,
    Craig - CRG IT Solutions - Microsoft Gold Partner

    -My posts after 08/2015 = .NET 4.x and Visual Studio 2015
    -My posts after 11/2011 = .NET 4.x and Visual Studio 2012
    -My posts after 02/2010 = .NET 4.0 and Visual Studio 2010
    -My posts after 12/2007 = .NET 3.5 and Visual Studio 2008
    -My posts after 04/2007 = .NET 3.0 and Visual Studio 2005
    -My posts before 04/2007 = .NET 1.1/2.0

    *I do not follow all threads, so if you have a secondary question, message me.

  3. #3
    Join Date
    Jul 2013
    Posts
    1

    Re: C# LDAP SSL connection fails

    I suggest you use Softtera Ldap software to test connections to Ldap before trying with the code. It will give you detailed error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured