asp.net文件下载函数

来源:互联网 发布:js tostring 参数 编辑:程序博客网 时间:2024/06/08 07:11
        ///   <summary>           ///   文件下载           ///   </summary>           ///   <param   name="FullFileName"></param>           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();        }
原创粉丝点击