I am trying fetch the PDF file which is return in form of bytes from the API
jQuery:
// jQuery ajax to get fileId and token
window.location.href = "/APIFileDownload/GetFile?fileId= "+ response.fileId + "&token="+ response.token;
C# (ASP.NET MVC)
[HttpGet]
public ActionResult GetFile(string fileId, string token)
{
// call API with token and file Id
// get bytes from string reponse
bytes[] fileDownload = Convert.FromBase64String(apiResult.filecontent)
return File(fileDownload, "application/pdf", "test_download.pdf")
}
Error:
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.
Please let me know how to return the file from this method.