I am a getting a FileContentResult from a web API for my desktop application.
{
"fileContents": "JVBERi0xLjMNCjEgMCBvYmoNNzQ3Ng0KJSVFT0Y=",
"contentType": "application/octet-stream",
"fileDownloadName": "",
"lastModified": null,
"entityTag": null,
"enableRangeProcessing": false
}
Need to know how the file can be downloaded?
I tried deserializing using Json.Net but it throws error 'Unknown object type! System.Byte'
Instead of Json.Net I tried with Newtonsoft.Json, with below code I was able to download the file.
Dim fcr As System.Web.Mvc.FileContentResult
fcr = Newtonsoft.Json.JsonConvert.DeserializeObject(Of System.Web.Mvc.FileContentResult)(json_string)
File.WriteAllBytes("e:\test.pdf", fcr.FileContents)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.