title: C# - MS Charts image becomes blank after saving it
body: <p>I have a page that displays a generated MS chart according to the selected options. </p>
  
  <p>Previously when doing it on my local, I could save the chart image and display it in an excel sheet through ExcelDl_Click. But after deploying the system to the IIS, the saved "chart" image that I get is a blank square image.</p>
  
  <p>Here is the code which is used on both the local and in deployment:</p>
  
  <pre><code>    protected void ExcelDl_Click(object sender, EventArgs e)
      {
          Response.Clear();
          Response.Buffer = true;
          Response.AddHeader("content-disposition", "attachment;filename=ViewHistoryChart.xls");
          Response.ContentType = "application/vnd.ms-excel";
          Response.Charset = "";
          StringWriter sw = new StringWriter();
          HtmlTextWriter hw = new HtmlTextWriter(sw);
          Chart1.RenderControl(hw);
  
          string tmpChartName = "ChartImage.jpg";
          string imgPath = HttpContext.Current.Request.PhysicalApplicationPath + tmpChartName;
          Chart1.SaveImage(imgPath);
  
          string src = tmpChartName;
          string img = string.Format("&lt;img src = '{0}{1}' /&gt;", HttpContext.Current.Request.PhysicalApplicationPath, src);
  
          Table table = new Table();
          TableRow row = new TableRow();
          Unit width = new Unit(500, UnitType.Pixel);
          row.Cells.Add(new TableCell());
          row.Cells[0].Width = width;
          row.Cells[0].Controls.Add(new Label { Text = ChartTitle.Text,  ForeColor=Color.Red, });
          table.Rows.Add(row);
          row = new TableRow();
          row.Cells.Add(new TableCell());
          row.Cells[0].Controls.Add(new Literal { Text = lblSectionFunctionSelected.Text });
          table.Rows.Add(row);
          row = new TableRow();
          row.Cells.Add(new TableCell());
          row.Cells[0].Controls.Add(new Literal { Text = img });
          table.Rows.Add(row);
          row.Cells.Add(new TableCell());
          row.Cells[0].Controls.Add(new Literal { Text = lbllegendHistory.Text });
          table.Rows.Add(row);
  
          sw = new StringWriter();
          hw = new HtmlTextWriter(sw);
          table.RenderControl(hw);
          Response.Write(sw.ToString());
          Response.Flush();
          Response.End();
      }
  </code></pre>
  
  <p>When I click on the ChartImg.axd image link on the page, the chart is displayed correctly. But after I click on ExcelDl_Click, the link will display nothing after reopening it. I have a feeling that it has something to do with how I save the image but I'm not sure. Are there any package updates needed to solve this issue? Any help will be greatly appreciated.</p>