.Net 下载文件,用的MVC模式
代码如下,public ActionResult Download(string fName,string fPath)
{
string fileName = fName;
string filePath = fPath;
FileStream fs = new FileStream(filePath, FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
Response.Charset = "UTF-8";
//Response.ContentEncoding = System.Text.Encoding.GetEncoding("");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
return new EmptyResult();
}
测了一下,下载文件最大只能是100多M的,如何实现无限制大小的文件下载! --------------------编程问答-------------------- 点他
补充:.NET技术 , C#