c# - DirectoryServicesCOMException was unhandled Invalid DN syntax in Directory service -


i tried connect our ad using ldap query through c# .

directoryentry de = new directoryentry("ldap://ldap.mysite.gov.sa:389/ou=mysitecsp,ou=government ca,o=national center ,c=la");  // de.refreshcache(); directorysearcher dsearch = new directorysearcher(de); dsearch.filter = "(cn=aabs@mysite.gov.sa)"; //search how want.  google "ldap filter" more. searchresultcollection rc = dsearch.findall(); x509certificate stt = new x509certificate(); 

and error :-

system.directoryservices.directoryservicescomexception unhandled   hresult=-2147016654   message=an invalid dn syntax has been specified.    source=system.directoryservices   errorcode=-2147016654   extendederror=13   extendederrormessage=invalid dn syntax   stacktrace:        @ system.directoryservices.directoryentry.bind(boolean throwiffail)        @ system.directoryservices.directoryentry.bind()        @ system.directoryservices.directoryentry.get_adsobject()        @ system.directoryservices.directorysearcher.findall(boolean findmorethanone)        @ system.directoryservices.directorysearcher.findall()        @ ncdctoolkit.utilities.ldapquery.query(string csp_name, string query) in c:\users\yrajhi\documents\visual studio 2012\projects\ncdctoolkit\ncdctoolkit\utilities\ldapquery.cs:line 23        @ ncdctoolkit.program.main(string[] args) in c:\users\yrajhi\documents\visual studio 2012\projects\ncdctoolkit\ncdctoolkit\program.cs:line 46        @ system.appdomain._nexecuteassembly(runtimeassembly assembly, string[] args)        @ system.appdomain.executeassembly(string assemblyfile, evidence assemblysecurity, string[] args)        @ microsoft.visualstudio.hostingprocess.hostproc.runusersassembly()        @ system.threading.threadhelper.threadstart_context(object state)        @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)        @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)        @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state)        @ system.threading.threadhelper.threadstart()   innerexception:  

any ?

ou=mysitecsp,ou=government ca,o=national center ,c=la

^^ not valid dn. @ distinguishedname property of organisational unit in active directory correct name.

they should in format ou=myou,dc=mydomain,dc=local or similar.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -