I'm calling a WCF service using HttpClient that returns a byte[] (pdf file) via rest/json. I cannot seem to be able the write the bytes correctly to a file on my pc because if I open the created file in notepad, it will just show the byte[] values (i.e. [23,44,21,etc]).
Any ideas?
byte[] responseResult = responseContent.ReadAsByteArrayAsync().Result;
File.WriteAllBytes(@"I:\document.pdf", responseResult);
Resultis actually a textual representation of the byte array, rather than actually containing an array of bytes. Have you had a look at the raw JSON to see what is inResult?