My actions are returning the file from disk to the 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); }
Thus, it loads the entire file into memory and works very slowly, since the download starts after the file is loaded into memory. What is the best way to handle such files?
thanks
source share