首页 > 其他 > 详细

Export功能 导致 页面显示很多非法字符,还可能页面显示两次

时间:2015-11-24 16:04:36      阅读:304      评论:0      收藏:0      [点我收藏+]
        private void exportBinaryToExcel(byte[] bytes, string filename)
        {
            Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
            Response.AddHeader("Content-Length", bytes.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.BinaryWrite(bytes);
            Response.Flush();
            Response.End(); //这里的问题
        }

发现页面局部展示了两次,思考后感觉是页面展现的方法中没有清空上一次的内容,找到代码Response, Google发现Response.End()是结束当前的页面。解决!

Export功能 导致 页面显示很多非法字符,还可能页面显示两次

原文:http://www.cnblogs.com/webglcn/p/4991806.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!