【发布时间】:2019-07-11 08:15:12
【问题描述】:
我正在尝试使用以下代码连接 AD
VMADProfile _VMADProfile = new VMADProfile();
DirectoryEntry searchRoot = new DirectoryEntry("Test AD LDAP Path", "DomainName\\username", "password");
directorySearcher.Filter = "(&(objectCategory=user)(samAccountName=" + username + "))";
directorySearcher.PropertiesToLoad.Add("displayname");
SearchResult one = directorySearcher.FindOne();
但它给了我以下错误
The user name or password is incorrect.
8009030C: LdapErr: DSID-0C090579, comment: AcceptSecurityContext error, data 52e, v3839
如果我直接登录,我可以使用相同的用户名和密码登录。 我尝试连接的 AD 与我正在运行的代码不同。如果我将测试广告更改为生产广告,则相同的代码可以正常工作
【问题讨论】:
-
错误 52e 表示凭据无效,即密码不正确。
-
正如我提到的密码是正确的,我可以使用相同的 AD 登录到服务器
-
我只是说错误的含义。密码中可以包含非 ascii 字符吗?
-
是的,我已经有了大写小写特殊字符和数字
-
那么可能是字符集问题。 Latin1 与 Unicode。
标签: c# .net authentication active-directory ldap