28,391
社区成员
发帖
与我相关
我的任务
分享
public static void DownLoadPdf2(string pdfpath, string filename)
{
HttpResponse _Response = HttpContext.Current.Response;
FileInfo fileInfo = new FileInfo(pdfpath);
_Response.Clear();
_Response.ClearHeaders();
_Response.Buffer = false;
_Response.ContentType = "application/octet-stream";
_Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename,
System.Text.Encoding.UTF8));
_Response.AppendHeader("Content-Length", fileInfo.Length.ToString());
_Response.TransmitFile(fileInfo.FullName);
_Response.Flush();
_Response.End();
}