Very strange scenario happens with me
when I try to post something to the WCF method and this something has \r as two separate characters actually I send “domain\machine” to the WCF.
The strange thing is that the machine name starts with R so the string I send is
“domain\r**” so when WCF receives it it asssumes I want to send \r which stands for line feed character so it replace it with single character. any hint how to avoid this?
This is the function signature
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "json/listServer")]
Response ListShares(Request request);
Request is a data contract class that has only one data member ServerName which is of type string.
For some unknown reason to send \ in the the POST method to WCF web method you need to send it as \\\\ because JSON parser on the WCF side will try to find any escape characters followed by it!!