I have a rest webservice and i want to transfer a username in the body of a webrequest. The username looks like this: DOMAIN\robert.miller But the username which comes to the server is DOMAINobertmiller. It escapes the string!
Here is my code how i post the string:
byte[] body = new UTF8Encoding().GetBytes("\"" + changeAccount + "\"");
HttpWebRequest httpWebRequest = WebRequest.CreateHttp(urlNActions);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/json; charset=UTF-8";
httpWebRequest.ContentLength = body.Length;
httpWebRequest.Headers.Add("Authorization", "Basic " + userNameAndPw);
httpWebRequest.GetRequestStream().Write(body, 0, body.Length);