Directory用户详细信息

Directory用户详细信息

本文介绍了通过LDAP的ASP中的Active Directory用户详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要使用C#通过ASP页面中的LDAP获取AD(活动目录)中在线或登录用户的详细信息.

在此先感谢

问候,
Krishnamoorthy S

Hi,

I need to get the details of online or logged user in an AD (Active Directory) through LDAP in ASP page using C#.

Thanks in advance

Regards,
Krishnamoorthy S

推荐答案

DirectoryEntry entry

实际上是LDAP设置,在

is actually the LDAP Setting and in the

search.PropertiesToLoad.Add("samAccountName");


您可以从AD加载所需的任何信息,例如名字,姓氏和国家/地区



you can load what ever information you need from AD like First Name , LastName and Country


  object obj = entry.NativeObject;
 string filterCriteria = "(&(objectCategory=user)(objectClass=person)(sAMAccountName=" + /* Logged in user name */+ "))";
 DirectorySearcher search = new DirectorySearcher(entry);
 search.Filter = filterCriteria;
 search.PropertiesToLoad.Add("samAccountName");
 SearchResult result = search.FindOne();
 if (result == null)
 {
    //Load your required values
 }
}


这篇关于通过LDAP的ASP中的Active Directory用户详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 00:08