title: ExportToHttpResponse Crystal Report without running CRViewer
body: <p>So i am attempting to export a crystal report to pdf without opening the report in the runtime viewer of my web application using the </p>
  
  <blockquote>
    <p>ExportToHttpResponse</p>
  </blockquote>
  
  <p>method. Everything seems to be performing correctly when it comes to loading the parameters, getting the filename/path loading the report. But when i execute the part that is suppose to create a popup dialog box giving the user the option to save,run,cancel for any type of download nothing happens. No error is thrown. it isn't stepping over any part of the code that i'm aware of. It seems to run the ExportToHttpResponse line and then do nothing with it.</p>
  
  <p>So i was hoping someone could give me some direction in what i could be doing wrong with the code found below:</p>
  
  <pre><code>protected void ExportRptButton_Click( object sender, EventArgs e )
          {
              if ( null != SelectedReport )
              {
                  rptParams.Clear();
                  rptParams = null;
  
                  // Get the report document
                  // string filePath = Server.MapPath( @"~\Reports\" + SelectedReport.FileName + ".rpt" );
                  // Declare a new Crystal Report Document object and load the report file into the report document.
                  ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                  ConfigureCrystalReports(rptDoc);
                  // repDoc.Load(rptFileName);
  
                  // AddParameters();
                  // Set the report parameters the report object.
                  LoadParameterFields(rptDoc);
                  // Set the static text fields in the report object.
                  LoadStaticTextFields(rptDoc);
  
                  try
                  {
                      if (rptDoc.IsLoaded)
                      {
                          // Stop buffering the response
                          Response.Buffer = false;
                          // Clear the response content and headers
                          Response.ClearContent();
                          Response.ClearHeaders();
                          Response.ContentType = "application/pdf";
                          // Export the Report to Response stream in PDF format and file name Customers
                          rptDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "DirectAccessReport");
                          // rptDoc.ExportToDisk(ExportFormatType.PortableDocFormat, "~/PDF_Folder");
                          // There are other format options available such as Word, Excel, CVS, and HTML in the ExportFormatType Enum given by crystal reports
                      }
                  }
                  catch ( Exception ex )
                  {
                      logger.ErrorFormat("Could not export to pdf! {0}", ex);                  
                  }
              }
          }
  </code></pre>
  
  <p><strong>Some notes</strong>: the LoadParametersFields/LoadStaticTextFields methods displayed above seem to be working correctly and when used to open the report in the crviewer the report comes up and works. Although, if you wish to see those methods as well i'll throw them up on request.</p>
  
  <p>The rptParams in the beginning is a privately declared  <code>List&lt;ReportParameter&gt;()</code></p>
  
  <p>the ConfigureCrystalReports method is used to obtain and load the filepath of the report.</p>
  
  <p>any help or suggestions are greatly appreciated. Thank you.</p>