2 回答
TA贡献1829条经验 获得超7个赞
我建议你试试LdapDistinguishedNameEncode(string, bool, bool)超载。取自AntiXSS 4.0 Released:
还提供了LdapDistinguishedNameEncode(string, bool, bool),因此您可以关闭初始或最终字符转义规则,例如,如果您将转义的专有名称片段连接到完整专有名称的中间。
希望能帮助到你!
TA贡献1864条经验 获得超2个赞
我没有找到仍然让我使用 LdapDistinguishedNameEncode 的可行方法。
我采用的代码是:
// Reject organization names with illegal or problematic characters (taken from RFC2253).
// Used instead of Encoder.LdapDistinguishedNameEncode because of an expectation that
// the creation passes through the same function.
// https://social.technet.microsoft.com/wiki/contents/articles/5312.active-directory-characters-to-escape.aspx
char[] illegalChars = {',', '\\', '#', '+', '<', '>', ';', '"', '='};
if (name.IndexOfAny(illegalChars) >= 0)
{
return false;
}
- 2 回答
- 0 关注
- 216 浏览
添加回答
举报
