您的位置:首页 > 其它

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

2015-11-24 15:42 429 查看
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()是结束当前的页面。解决!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: