asp.net core 生成文件下载
1 public IActionResult down(int id, string filename) 2 { 3 string path = hostingEnvironment.WebRootPath + "/ContractFiles/" + id + "/" + filename; 4 5 6 var contentType = "APPLICATION/octet-stream"; 7 8 FileStream fs = new FileStream(path, FileMode.Open); 9 return File( fs, contentType, filename); 10 11 12 }