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()是结束当前的页面。解决!