title: Excel sheet does not display exported chart image - ASP.NET
body: <p>I have a web page in my website that allows me to download the chart from that page and add it to an excel sheet. However, a  red x button with the words: "this image cannot currently be displayed" is shown in place of the chart. I have tried many solutions online but all of them show the same outcome.</p>
  
  <p>Here are my codes: </p>
  
  <pre><code>    protected void ExcelDl_Click(object sender, EventArgs e) {
          string tmpChartName = "test2.jpg";
          string imgPath = HttpContext.Current.Request.PhysicalApplicationPath + tmpChartName;
          Chart1.SaveImage(imgPath);
          string imgPath2 = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/" + tmpChartName);
  
          Response.Clear();
          Response.ContentType = "application/vnd.ms-excel";
          Response.AddHeader("Content-Disposition", "attachment; filename=test.xls;");
          StringWriter sw = new StringWriter();
          HtmlTextWriter hw = new HtmlTextWriter(sw);
          string headerTable = @"&lt;Table&gt;&lt;tr&gt;&lt;td&gt;&lt;img src='" + imgPath2 + @"' \&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/Table&gt;";
          Response.Write(headerTable);
          Response.Write(sw.ToString());
          Response.End();
      }
  </code></pre>
  
  <p>Any form of help will be greatly appreciated. Also, do note that I have added the required codes in my Web.config.</p>