我做一个下载页面,用Response.Flush()输出内容,当buffer从txt文档读取内容时, Response.Flush()输出带有html代码,doc/ppt/pdf没有问题,代码如下stream.Position = 0;
byte[] buffer = ModuleUtil.StreamToBytes(stream);Response.Clear();Response.AddHeader("content-type", "application/OCTET-STREAM;");
Response.AddHeader("Content-Disposition", "attachment;filename=" + strFileName);
Response.OutputStream.Write(buffer, 0, buffer.Length);Response.Flush();
byte[] buffer = ModuleUtil.StreamToBytes(stream);Response.Clear();Response.AddHeader("content-type", "application/OCTET-STREAM;");
Response.AddHeader("Content-Disposition", "attachment;filename=" + strFileName);
Response.OutputStream.Write(buffer, 0, buffer.Length);Response.Flush();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货