Click here to Skip to main content
15,742,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

We got some requiremetn to implement LDAP integration for other domain application.

As per my understanding we can implement the LDAP through below sample code.

                      String defaultNamingContext = string.Empty;
                      using (DirectoryEntry deRoot = new DirectoryEntry("LDAP://RootDSE"))
                          if (deRoot.Properties["defaultNamingContext"] != null)
                              defaultNamingContext =

                      DirectoryEntry entry = new DirectoryEntry("LDAP://" + defaultNamingContext, "", "XX@!@#$%^");
                      object nativeObject = entry.NativeObject;
                     bool authenticated = true;
                  catch(Exception ex)

                      String msg = ex.Message;

My question is :-

1) As LDAP mostly used for the intranet applications, Where we have read access to the LDAP, In my case I am not sure that deployed application will have read access to the LDAP server.

Is there any other way to authenticate users without hosting an application in their domain/intranet for LDAP, What all are the other way to implement LDAP in my case and what all are the input required from the client side like any access rights or permission?
[no name] 5-Oct-15 3:06am    
What ever account( you are passing to DirectoryEntry, that user should have read/write permission to access the LDAP. You can ask Admin to get the access.
Jitenrda Soni 5-Oct-15 7:34am    
Hi Manas,

Yes, We can ask for the rights and that will be not an issue.

but in case if the hosting repository itself not in the domain, it's outside to the domain then we can't access the AD with above approach.

My question is :-

Is there any other way to authenticate through LDAP, If application not hosted in domain itself like is there any LDAP default exposed services or some setting where we can enable the service and get authenticate outside, Without creating any wrapper.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900