public partial class _Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){byte[] bytes = File.ReadAllBytes("D:\toClient.xls");//toClient.xls 大小為20MResponse.BinaryWrite(bytes);}}運行后直接報:System.OutOfMemoryException
2 回答

開心每一天1111
TA貢獻1836條經驗 獲得超13個贊
一般是這么寫:
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(downloadName, System.Text.Encoding.UTF8));
Response.WriteFile("D:\toClient.xls");
Response.Flush();
Response.End();
- 2 回答
- 0 關注
- 720 瀏覽
添加回答
舉報
0/150
提交
取消