What's the connection string for LDAP?

南笙酒味 提交于 2019-12-01 10:14:40

问题


Here how I need to use it:

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

When I try to run some code using this connection, I get an exception. (See this question for more information).

I've been told I need to provide the connection string with credentials - a username and a password.

What's the connection string like? I need the exact syntax. :) Thanks!

I'm using Windows Server 2003 and Active Directory.


回答1:


The credentials don't go into the connection string, but are separate parameters on another overload of the DirectoryEntry constructor:

var entry = new DirectoryEntry(tmpDirectory, "username", "password");


来源:https://stackoverflow.com/questions/5359721/whats-the-connection-string-for-ldap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!