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 关注
- 669 浏览
添加回答
举报
0/150
提交
取消