文件下载

转载于:http://www.cnblogs.com/TiestoRay/archive/2013/09/30/3346692.html

public void FileDownLoadByByte(byte[] fileData, string fileName)
{
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer = true;
    Response.ContentType = "application/octet-stream";
    Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
    Response.AppendHeader("Content-Length", fileData.Length.ToString());
    Response.BinaryWrite(fileData);
    Response.Flush();
    Response.End();
}

 

posted on 2013-09-30 10:34  神秘的白起  阅读(115)  评论(0编辑  收藏  举报

导航