本文介绍了如何在 C# 中转义字符串,以用于 LDAP 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我有一个 LDAP 查询,我用它在 C# 中执行搜索.它使用两个字符串变量(用户名和域),出于安全原因需要对其进行转义.
I have an LDAP query, which I am using to perform a search in C#. It uses two string variables (username and domain) which need to be escaped for security reasons.
我应该如何转义字符串?C#.NET 中是否有可用的函数来执行此操作?
How should I escape the strings? Is there a function available in C#.NET to do this?
LDAP 搜索条件示例:
Example LDAP search conditions :
C# 中的 LDAP 查询字符串示例:
Example LDAP query string in C# :
我已经有 LDAP 查询工作,并返回结果.我想要的只是转义参数.
I already have the LDAP query working, and returning results. All I want is to escape the parameters.
推荐答案
以下是我从Sophia提到的Java代码翻译成C#.
The following is my translation from the Java code mentioned by Sophia into C#.
这篇关于如何在 C# 中转义字符串,以用于 LDAP 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!