什么是LDAP的连接字符串?

时间:2011-03-19 02:50:05

标签: c# active-directory ldap directoryservices

我在这里需要使用它:

string tmpDirectory = String.Format("LDAP://ou={0},dc={1},dc={2}", 
                                    parentOrganizationUnit,
                                    domainName,
                                    domainExtension
);

当我尝试使用此连接运行某些代码时,我得到一个例外。 (See this question for more information)。

我被告知需要为连接字符串提供凭据 - 用户名和密码。

连接字符串是什么样的?我需要确切的语法。 :)谢谢!

我正在使用Windows Server 2003和Active Directory。

1 个答案:

答案 0 :(得分:3)

凭据不会进入连接字符串,而是another overload of the DirectoryEntry constructor上的单独参数:

var entry = new DirectoryEntry(tmpDirectory, "username", "password");
相关问题