首页 新闻 搜索 专区 学院

IIS7 输出文件流问题

0
悬赏园豆:20 [待解决问题]

IIS7 上

HttpContext.Current.Response.ContentType = "application/octet-stream";
                            HttpContext.Current.Response.AddHeader("Connection", "Keep-Alive");
                            HttpContext.Current.Response.AddHeader("Content-Length ", bytes.Length.ToString());
                            //通知浏览器下载文件而不是打开
                            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
                            HttpContext.Current.Response.BufferOutput = true;
                            HttpContext.Current.Response.BinaryWrite(bytes);

HttpContext.Current.Response.Flush(); /*******此处报错******/
                            HttpContext.Current.Response.Close();

liusaup的主页 liusaup | 初学一级 | 园豆:10
提问于:2012-11-28 18:58
< >
分享
所有回答(1)
0

HttpContext.Current.Response.End();   

替换掉你原先的那个Flush()

chenping2008 | 园豆:9836 (大侠五级) | 2012-11-28 20:34
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册