如何在连接字符串中转义空格

问题描述 投票:1回答:2

如何使用此示例为(受信任的移动用户)在连接字符串中转义空格。

我有一个称为Trusted mobile users的OU:

connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users, DC=floor, DC=net"
c# asp.net active-directory ldap connection-string
2个回答
0
投票

您无需在LDAP路径中转义空格。您也不要在逗号后留空格:

connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users,DC=floor,DC=net"

如果绑定到特定对象(在这种情况下为OU),则您使用的专有名称(DN)应该与对象的distinguishedName属性中的名称完全匹配。

唯一的例外是正斜杠(/)。如果DN带有正斜杠,则在LDAP路径中使用它时,必须将其转义(使用\/),因为它用作分隔符(例如您在域名和DN之间使用)。


-1
投票
connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users, DC=floor, DC=net"
connectionString.Replace(" ", String.Empty);
© www.soinside.com 2019 - 2024. All rights reserved.