I arranged a similar context as you described, and I came across the same error. I managed to get it to work by removing " from the beginning and end of the content and replacing \/ with / .
Here is the code snippet:
var result = client.Execute(request); var response = result.Content .Substring(1, result.Content.Length - 2) .Replace(@"\/","/"); byte[] d = Convert.FromBase64String(response);
Alternatively, you can use XML for the response format:
[WebGet(UriTemplate = "ReadFile/Convert", ResponseFormat = WebMessageFormat.Xml)] public string ExportToExcel() {
On the client side:
request.AddHeader("Accept", "application/xml"); request.AddHeader("Content-Type", "application/xml"); request.OnBeforeDeserialization = resp => { resp.ContentType = "application/xml"; }; var result = client.Execute(request); var doc = new System.Xml.XmlDocument(); doc.LoadXml(result.Content); var xml = doc.InnerText; byte[] d = Convert.FromBase64String(xml);
Alex Filipovici Feb 27 '13 at 15:45 2013-02-27 15:45
source share