how to get data from Active Directory?

  • Thread starter Thread starter Luc
  • Start date Start date
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
 
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
 
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
 
Thanks Alexey ...

"Alexey Smirnov" <[email protected]> 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
 
Back
Top