title: Unable to render excel download from aspx page
body: <p>I have an ASP.NET (webforms) page that renders MS-Excel back to the response stream on click of a button. Everything works perfectly in testing but on live deployment, I get this dialogue box after the browser appears to be trying to download the file:
  <img src="https://i.stack.imgur.com/brLLR.png" alt="enter image description here">
  where ReportsShow.aspx is the name of the aspx page that generates and renders the excel.
  The button that triggers the download fires a postback so I am confounded as to why the page would not be found when it renders correctly on load?
  I am clueless and any help would be greatly appreciated</p>
  
  <p><strong>EDIT</strong>: As requested by Mayank, here's the code structure:</p>
  
  <pre><code>        // Get instance of reporting service
          IReportingService reportingServiceClient = Reports.GetWebService();
          // Get a fresh copy of the report
          BusinessReport theReport = reportingServiceClient.GetReport(AcctList.ToArray());
  
          ExcelExport excelExport = new ExcelExport();
  
          const string templateFileName = "Business-Report.xls";
          string newFileName = String.Empty;
  
          try
          {
              newFileName = excelExport.CopyTemplateFile(Server.MapPath("~/ExportTemplates/" + templateFileName));
              excelExport.WriteData(forexOptionReport, newFileName);
  
              Response.Clear();
  
              Response.AddHeader("content-disposition", string.Format("Attachment; filename=\"{0}\"", "Business-Report" + ".xls"));
              Response.ContentType = "application/vnd.ms-excel";
  
              Response.TransmitFile(newFileName);
              Response.Flush();
          }
          catch (Exception ex)
          {
              Errors.LogException("Error in Reports.BtnDownloadToExcel_Click", ex);
              throw;
          }
          finally
          {
              if (!String.IsNullOrEmpty(newFileName))
              {
                  excelExport.DeleteFile(newFileName);
              }
          }
  </code></pre>
  
  <p><strong>MORE INFO</strong></p>
  
  <p>I've analyzed this with fiddler and this is what I see for the particular request/response which is expected to present the excel for download:</p>
  
  <p><img src="https://i.stack.imgur.com/kaV0r.png" alt="enter image description here"></p>
  
  <p><a href="https://stackoverflow.com/questions/3874436/what-is-the-meaning-of-this-fiddler-icon">This Stackoverflow Q/A</a> states that the meaning of the forbidden icon is that the client is terminating/aborting the response</p>