c# - 在 .NET 中将域名转换为 LDAP 样式

标签 c# active-directory ldap

是否有内置的 C# 函数将点式域名 (my.domain.name) 转换为 LDAP 式域组件 (dc=my,dc=domain,dc=component?

最佳答案

string GetDomainDN(string domain)
{
    DirectoryContext context = new DirectoryContext(DirectoryContextType.Domain, domain);
    Domain d = Domain.GetDomain(context);
    DirectoryEntry de = d.GetDirectoryEntry();
    return de.Properties["DistinguishedName"].Value.ToString();
}

关于c# - 在 .NET 中将域名转换为 LDAP 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4620717/

相关文章:

c# - 如果内部标记与 C# 中的 Linq 值匹配,则删除 XML 节点

perl - 如何使用 Net::LDAP 修改 bool LDAP Active Directory 属性?

powershell - 使用 powershell 在 AD 中获取组织职位

authentication - 跨受信任域的 LDAP 用户身份验证

java - Active Directory - 通过指定搜索过滤器和搜索控件进行搜索,无需上下文

ldap - Identityserver4 ldap 场景

c# - Noobie Delegate 基础 C#

c# - asp.net 5 中的国际化

c# - 从 RichEditBox 中删除图像

sql - Active Directory 数据写入 SQL 表