I have a MVC GET action that returns a json class model with a byte[] property, I use this to return a message and the file, but if the file is too big, I would get a OutOfMemoryException, is there any other way to return file and data that wouldn't use such memory?
I know I can create another action to return only the final file, but can I do it on the same request?
Edit:
I don't want to use byte[] or any method that will load the file into memory
public ActionResult GetFile()
{
// Here: currently logic to create the final file and the message
// Here: I want to add the final file to the result
// Here: I want to add my model data(json) to the result
// Here: currently returning json with a byte[] property to return the file
return Json(myModel, JsonRequestBehavior.AllowGet);
}