是否有用于 LDAP 路径操作的 .NET 库?
我想要一些等效于 System.IO.Path
的东西,允许例如做类似的事情
Is there a .NET library for LDAP paths manipulations?
I would like to have something equivalent to System.IO.Path
, allowing e.g. to do something like
string ou1 = LDAPPath.Combine("OU=users","DC=x,DC=y");
string ou2 = LDAPPath.Parent("CN=someone,OU=users,DC=x,DC=y");
否则,在 .NET 中处理 LDAP 专有名称的常用方法是什么?
Otherwise, what's the common way to deal with LDAP distinguished names in .NET?
澄清我的问题:我一般不问.NET 中的目录服务";我已经使用它并完成了一些程序来执行一些任务.我觉得缺少的是操作路径、解析可分辨名称等的正确方法,并且由于这应该是一个非常普遍的需求,我希望有一种比拆分字符串更简洁的方法来做到这一点逗号(1).
To clarify my question: I'm not asking about "directory services in .NET" in general; I've already worked with that and done some programs to perform some tasks. What I feel is missing is a proper way to manipulate paths, parse distinguished names and so on, and since this should be a pretty common need, I hope there's a cleaner way to do this than split a string on commas(1).
(1) 例如,调用库中的函数以逗号分隔字符串
(1) like, for example, calling a function in a library that splits the string on commas
不,据我所知 - 即使在用于 Active Directory 的最新 .NET 3.5 命名空间中也不行.
No, not to my knowledge - not even in the most recent .NET 3.5 namespace for Active Directory.
您可以在目录本身中导航层次结构(转到父级等) - 但您需要绑定到例如Active Directory 通过 DirectoryEntry
.
You can navigate the hierarchy (going to the parent etc.) in the directory itself - but you need to be bound to e.g. Active Directory by means of a DirectoryEntry
.
然后是 NameTranslate
API,但这确实是更多的是将此名称更改为另一个名称",例如从用户主体名称更改为相关 DN - 同样,它需要连接到 AD 中的 DirectoryEntry
.
我对找到这样一个库最感兴趣,但到目前为止,我还没有听说过一个 - 无论是在 .NET 中,还是在任何其他语言中,真的.
I would be most interested in finding such a library, but so far, I haven't heard about one - neither in .NET nor in any other language, really.
回到我的重型" AD 编程时代,我有自己的一套 LDAP 路径操作例程(在 Delphi 中)——基本上只是字符串解析和处理.
Back in my "heavy-duty" AD programming days, I had my own set of LDAP path manipulation routines (in Delphi) - basically just string parsing and handling.
马克
这篇关于.NET LDAP 路径实用程序 (C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!