byte[] arrayofbyte = new System.Net.WebClient().DownloadData("http://pdfurl");
MemoryStream ms = new MemoryStream(arrayofbyte);
System.Web.HttpContext.Current.Response.ClearContent();
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
System.Web.HttpContext.Current.Response.AddHeader("ContentType", "application/pdf; charset=utf-8");
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.Ticks.ToString() + ".pdf" + ";");
System.Web.HttpContext.Current.Response.BinaryWrite(ms.ToArray());
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
答案 0 :(得分:0)
我认为您可能错过了内容长度标题。
System.Web.HttpContext.Current.Response.AppendHeader("Content-Length", ms.Length.ToString());