已知本地文件名,返回给前台流
string filepath = path +“/” + filename +".txt"; if(System.IO.File.Exists(filepath)) { byte[] bytes; using (Stream stream = new Filestream(FilePath,FileMode.Open)) { bytes = new byte[stream.Length]; stream.Read(bytes,0,bytes.length); stream.Close(); } return File(bytes,"application/octet-stream",filename+".txt"); //字段说明第一个字节流,第二个返回方式,第三个,返给前台的文件名 }