1,Controller中的方法
public FileResult DownloadRFQFile(string filename) { string folder = AppDomain.CurrentDomain.BaseDirectory + @"data\RFQReply\"; byte[] fileBytes = System.IO.File.ReadAllBytes(folder + filename); return File(fileBytes, "application/zip", filename); }
2,cshtml 页面中执行方法,获取下载文件
var url = "DownloadRFQFile?filename=" + dataFN; window.location.href = url;