Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Active Directory-如何在CN中转义逗号_C#_Active Directory - Fatal编程技术网

C# Active Directory-如何在CN中转义逗号

C# Active Directory-如何在CN中转义逗号,c#,active-directory,C#,Active Directory,如何在下面的广告路径中转义逗号字符(Smith,John)?我尝试过使用反斜杠,但这会产生错误:“无法识别的转义序列” 使用反斜杠转义(逗号需要转义): 也许你只是把“\”而不是“\”放在前面? 在C语言中,您需要“\\”来指定反斜杠。您不能转义,,因为它不需要转义。字符串中没有需要转义的内容。 DirectoryEntry entry = new DirectoryEntry(); entry.Path = "LDAP://domain/CN=Smith, John, OU=Distribut

如何在下面的广告路径中转义逗号字符(Smith,John)?我尝试过使用反斜杠,但这会产生错误:“无法识别的转义序列”

使用反斜杠转义(逗号需要转义):

也许你只是把“\”而不是“\”放在前面?
在C语言中,您需要“\\”来指定反斜杠。

您不能转义
,因为它不需要转义。字符串中没有需要转义的内容。
DirectoryEntry entry = new DirectoryEntry();
entry.Path = "LDAP://domain/CN=Smith, John, OU=Distribution...
"LDAP://domain/CN=Smith\\, John, OU=Distribution..."