Exception : There is no such object on the server at System

1

I try to obtain a certificate with LDAP, but i have an exception

System.Runtime.InteropServices.COMException(0x80072030): There is no such object on the server at System

My code :

Dim ldapUrl = "LDAP://annuaire.sesam-vitale.fr/cn=amo_pj.test@test.rss.fr,ou=AC-FACTURATION,ou=AC-SESAM-VITALE-2034,o=sesam-vitale,c=fr?userCertificate;binary"

Dim de As DirectoryEntry = New DirectoryEntry(ldapUrl)
de.AuthenticationType = AuthenticationTypes.None
Dim dsearch As DirectorySearcher = New DirectorySearcher(de)
dsearch.Filter = "(objectClass=*)"
Dim rs As SearchResult = dsearch.FindOne()

I have this exception at last line. I have no idea and need your help.

Thank you

(sorry for my english)

EDIT

I resolve my problem :

Public Function certificatLDAP() As X509Certificate2

        Dim certificat As X509Certificate2 = Nothing

        Dim ldapconn As LdapConnection = New LdapConnection(New LdapDirectoryIdentifier("annuaire.sesam-vitale.fr"))

        Try

            ldapconn.AuthType = AuthType.Anonymous
            ldapconn.SessionOptions.ProtocolVersion = 3


            Dim attribut(1) As String
            attribut(0) = "userCertificate;binary"

            Dim request As SearchRequest = New SearchRequest("cn=amo_pj.test@test.rss.fr,ou=AC-FACTURATION,ou=AC-SESAM-VITALE-2034,o=sesam-vitale,c=fr", "(ObjectClass=*)", Protocols.SearchScope.Base, attribut)

            Dim reponse As SearchResponse = CType(ldapconn.SendRequest(request), SearchResponse)

            For Each test As SearchResultEntry In reponse.Entries
                For Each toto As DictionaryEntry In test.Attributes
                    Dim tata As DirectoryAttribute = toto.Value
                    Dim tutu As Byte() = tata(0)
                    Return New X509Certificate2(tutu)
                Next
            Next

        Catch ex As Exception
            Throw ex
        Finally
            ldapconn.Dispose()
        End Try

        Return certificat
    End Function
vb.net
ldap
directoryentry
comexception
asked on Stack Overflow Dec 4, 2015 by dark ryus • edited Dec 23, 2015 by dark ryus

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0