文件下载 http 报头

private void DownloadFile(RepeaterCommandEventArgs e)         {            

  string fileName = e.CommandArgument as string;            

  string path = this.Server.MapPath("../images");            

  string fullpath = string.Format("{0}/{1}", path, fileName);

       

  //这里主要用于下载                 

  Response.ContentType = "application/octet-stream";            

  string headerValue = string.Format("attachment; filename={0}", this.Server.UrlEncode(fileName));            

  Response.AddHeader("Content-Disposition", headerValue);  

                      

  Response.Clear();            

  Response.TransmitFile(fullpath);            

  Response.End();

        }

原文地址:https://www.cnblogs.com/Harry369/p/3065178.html