how to get data from Active Directory?

L

Luc

Hi,

users log in with their personal number (5 digits) in our intranet. For each
number, there is a name associated in the Active Directory of the domain
server.

Now, there is an asp.net application which read the number
(Request.ServerVariables("remote_user")).
My question is: is it possible to get the name from the AD in the
application?
Thanks
Luc
 
G

Guest

Hi,

users log in with their personal number (5 digits) in our intranet. For each
number, there is a name associated in the Active Directory of the domain
server.

Now, there is an asp.net application which read the number
(Request.ServerVariables("remote_user")).
My question is: is it possible to get the name from the AD in the
application?
Thanks
Luc

Hi Luc,

yes, you can do it, for example, by doing LDAP request. LDAP is a
protocol for querying and modifying directory services.

Read more about System.DirectoryServices at
http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx

Example of the code you have

DirectoryEntry de = new DirectoryEntry(ldapPath);
DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = "(name=12345)"; // where 12345 is your name
SearchResult sr = ds.FindOne();
DirectoryEntry do = sr.GetDirectoryEntry();
Response.Write ((string)do.Properties["displayName"].Value); // where
displayName is default standard name for full name

Hope this helps
 
G

Guest

Hi Luc,

yes, you can do it, for example, by doing LDAP request. LDAP is a
protocol for querying and modifying directory services.

Read more about System.DirectoryServices athttp://msdn.microsoft.com/en-us/library/system.directoryservices.aspx

Example of the code you have

Example of the code you CAN have
 
L

Luc

Thanks Alexey ...

"Anon User" <> schreef in bericht
Hi Luc,

yes, you can do it, for example, by doing LDAP request. LDAP is a
protocol for querying and modifying directory services.

Read more about System.DirectoryServices
athttp://msdn.microsoft.com/en-us/library/system.directoryservices.aspx

Example of the code you have

Example of the code you CAN have
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top