如何在 .NET 中获取 DirectorySearcher 的 SearchResult 的 DN?
我们如何可靠地获取 SearchResult
的 DN
?
我们一直在使用 SearchResult.Properties["dn"]
,但最近遇到了不支持此功能的安装。该客户还有其他应用程序可以归结为调用 Win32 的 ldap_get_dn
方法,但 .NET 中似乎没有与 SearchResult
等效的方法。
该解决方案需要跨 LDAP 服务器工作,而不是特定于 ActiveDirectory。
How can we reliably get the DN
of a SearchResult
?
We've been using SearchResult.Properties["dn"]
but recently encountered an installation where this is not supported. This customer has other applications that boil down to calling Win32's ldap_get_dn
method, but there doesn't seem to be an equivalent for SearchResult
in .NET.
The solution needs to work across LDAP servers, not ActiveDirectory-specific.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
起初并不清楚,但后来我们发现
SearchResult.Path
属性包含 DN 并且可以对其进行解析。这与我们迄今为止遇到的所有服务器一致。SearchResult.Path 属性
http: //msdn.microsoft.com/en-us/library/system.directoryservices.searchresult.path.aspx
It wasn't clear at first but we later found out the
SearchResult.Path
property contains the DN and can be parsed for it. This worked consistently with all servers we've encountered so far.SearchResult.Path Property
http://msdn.microsoft.com/en-us/library/system.directoryservices.searchresult.path.aspx
基本对象
始终是一个专有名称,可通过 LDAP 搜索结果条目(但不是搜索结果引用)使用。然而,专有名称不是属性。The
base object
, which is always a distinguished name, is made available via the LDAP search result entry (but not a search result reference). The distinguished name is not an attribute, however.