How do I return a byte array from an action? It is not an image, not a PDF, not a file, just a byte array. The client is a device, which does not treat it as anything except for a byte array. It's firmware just read this byte array byte by byte.
Try using the File helper or use a FileContentResult. I believe the content type application/octet-stream is for generic binary data:
public ActionResult GetFile()
{
byte[] fileBytes = null; // assign bytes
return File(fileBytes, "application/octet-stream");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With