文件下载方法

来源:互联网 发布:淘宝销量会是刷的吗 编辑:程序博客网 时间:2024/05/03 00:41
private void FileDownload(string FullFileName)
{
    FileInfo DownloadFile = new FileInfo(FullFileName);
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer=false;
    Response.ContentType="application/octet-stream";
    Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
    Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
    Response.WriteFile(DownloadFile.FullName);
    Response.Flush();
    Response.End();
}


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=671406