asp.net webform download excel

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();
}

 

posted @ 2015-07-27 14:00  webglcn  阅读(367)  评论(0编辑  收藏  举报