I pass a string from the console to the WCF service:

"@ _ ^ { } \ [ ~ ] | ! " # & ' ( ) * + , - . / : ; < = > ?" 

If you send it directly, we get an error

The remote server returned an error: (500) Internal server error.

However, manually escaping these &amp;quot; &amp;amp; &amp;quot; &amp;amp; and transmit so, then in the same form they will come to the service. How to properly shield in this case, such characters?

1 answer 1

line escaping:

 Uri.EscapeDataString(txt);