My action returns a file from disk to client browser and currently I have:
public FileResult MediaDownload ()
{
byte[] fileBytes = System.IO.File.ReadAllBytes(Server.MapPath(filePath));
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
This way it loads whole file in memory and is very slow, as the download start after the file is loaded to memory. What's the best way to handle such file downloads?
Thank you