Escape reserve characters when searching for OU by name
I have written a search utility to search for AD objects. It is working perfectly.
the problem arises when any OU name have a reserve character in its name for example ','
and before searching I use 开发者_如何学JAVAto replace ',' with '\,' and it works fine.
but I check only for ',' not for other reserve characters.
Is there any way that I can escape those characters also, before searching?
Thanks
You can try using "@" to escape special characters. Example:
string strSpecialChar = @"this,is'with&special?chars";
You can escape all these by prefixing with a "\".
精彩评论