What's the connection string for LDAP?

2019-02-20 12:45发布

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条回答
Fickle 薄情
2楼-- · 2019-02-20 13:05

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");
查看更多
登录 后发表回答