I have c# client and c# server (mvc4 api controller) and I want to transfer image via json. I write on the client:
var memoryStream = new MemoryStream();
image.Save(memoryStream, ImageFormat.Jpeg);
var baseStr64 = Convert.ToBase64String(memoryStream.ToArray());
response.Image = baseStr64;
(new JavaScriptSerializer).Serialize(response);
...Sending
Without image controller gets the request class normal, but with image base64 string field I have a null parameter in controller. Then I noticed that output json fails in online json validators on this base64 field. My output json can be found here: http://pastebin.com/wnAJpZGV
How to transmit image correctly?