如何使用此示例为(受信任的移动用户)在连接字符串中转义空格。
我有一个称为Trusted mobile users
的OU:
connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users, DC=floor, DC=net"
您无需在LDAP路径中转义空格。您也不要在逗号后留空格:
connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users,DC=floor,DC=net"
如果绑定到特定对象(在这种情况下为OU),则您使用的专有名称(DN)应该与对象的distinguishedName
属性中的名称完全匹配。
唯一的例外是正斜杠(/
)。如果DN带有正斜杠,则在LDAP路径中使用它时,必须将其转义(使用\/
),因为它用作分隔符(例如您在域名和DN之间使用)。
connectionString="LDAP://floor.net/OU=USERS,OU=Trusted mobile users, DC=floor, DC=net"
connectionString.Replace(" ", String.Empty);