如何在mvc中下载大文件而不将其加载到内存中

时间:2018-03-28 10:26:46

标签: asp.net-mvc

我的代码:

public FileResult Download(string fileName) {
    string fullPath = Path.Combine(Server.MapPath("~/"), fileName);
    byte[] fileBytes = System.IO.File.ReadAllBytes(fullPath);
    return File(fileBytes,System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}

0 个答案:

没有答案