none
Active Directory Connection - LDAP over SSL RRS feed

  • Question

  • I have used the below code to connect to an Active Directory

    using (DirectoryEntry objDE = new DirectoryEntry("LDAP://url:636/DC=aa,DC=bb", "adminUserName", "adminPassword"))
                    {
                        objDE.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
                        
                        using (DirectorySearcher searcher = new DirectorySearcher(objDE))
                        {
                            searcher.Filter = "(&(objectCategory=user)(cn=user1))";
                            searcher.SearchScope = System.DirectoryServices.SearchScope.Subtree;
                            SearchResult sResult = searcher.FindOne();
                        }
                    }

    this code is working fine from within the AD server. Is this the correct way to connect to an AD using LDAP over SSL?

    when i use the url "LDAPS://url:636/DC=aa,DC=bb" .It gives an Unknown error.

    Thanks in Advance,

    Rahul R

    Thursday, February 14, 2013 6:24 AM

Answers

  • Hi,

    Yes its correct.

    LDAPS is invalid addressing format, it is just a term of convenience in documentation to show that SSL is being used.  Same with FTPS (FTP over SSL) - you still address using ftp:// not ftps://


    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, February 18, 2013 2:33 AM

All replies

  • Hi Raul,

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Bob Shen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 15, 2013 9:20 AM
    Moderator
  • Hi,

    Yes its correct.

    LDAPS is invalid addressing format, it is just a term of convenience in documentation to show that SSL is being used.  Same with FTPS (FTP over SSL) - you still address using ftp:// not ftps://


    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, February 18, 2013 2:33 AM
  • Hi Raul,

    Your code ""LDAP://url:636/DC=aa,DC=bb"" works fine within AD server; But how can I make use of LDAP over SSL from a remote machine; I could know that I am facing certificate problem; But I don't know how to set Validation for 'DirectoryEntry objDE'; can you please let me know?

    Thursday, July 2, 2015 11:14 AM