LDAP path

S

sck10

Hello,

I was given some code that was done in ColdFusion, and I am trying to figure
out how to map the LDAP path. Any help would be appreciated.

This is what I got from the Microsoft web site
// Path to you LDAP directory server.
string adPath = "LDAP://yourCompanyName.com/DC=yourCompanyName,DC=com";
LdapAuthentication adAuth = new LdapAuthentication(adPath);

This is the code snippet that I got fro ColdFusion
-------------------------------------------------
<cfldap action="QUERY"
name="empquery_login"
attributes="employeenumber,roomnumber,sname"
start="ou=people, o=lucent.com"
filter="(employeenumber=#ssno#)"
scope="onelevel"
server="ldap-useast.train.com"
port="389">
 
P

Peter Huang [MSFT]

Hi,

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Joe Kaplan \(MVP - ADSI\)

I'm not sure what "LdapAuthentication" is here, but if that is an MS sample,
there is a good chance that it is AD-specific and should not be used.

What are you trying to do here, authenticate a user to an LDAP directory or
just look up some attribute values from their user object in the LDAP store?

Given that the example below is a simple search, I'll assume the latter. In
that case, you would want to try to use the DirectorySearcher with something
like this:

//air code, may not compile
DirectoryEntry root = new
DirectoryEntry("LDAP://ldap-useast.train.com/ou=people, o=lucent.com", "",
"", AuthenticationTypes.None);
DirectorySearcher searcher = new DirectorySearcher(root);
searcher.SearchScope = SearchScope.OneLevel;
searcher.PropertiesToLoad.AddRange(new string[] {"employeenumber",
"roomnumber", "sname"});
searcher.Filter = String.Format("(employeenumber={0})", empNum); //you
provide that parameter...
SearchResult result = searcher.FindOne();
//then retrieve the values from the result.Properties collection

The trick here will be in providing the correct credentials and
authentication types to work with your directory. In the example above, I
provided a null user and password, but that might not be right. Using
AuthenticationTypes.Anonymous may also be correct.

The other thing to watch out for would be schema mapping issues. ADSI/S.DS
is notorious for struggling to parse the schema of third-party LDAP
directories, so if you get weird "cannot convert datatype" errors, that is
the problem. In that case, you might not be able to get this to work with
S.DS and might need to wait for .NET 2.0 and
System.DirectoryServices.Protocols.

HTH,

Joe K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,091
Members
48,773
Latest member
Kaybee

Latest Threads

Top