title: ASP.NET ReportViewer Server Report Render Stream results in exception
body: <p>I'm trying to use the <code>ServerReport.RenderStream</code> method from the ASP.NET ReportViewer (2008 SP1), but I'm getting a <code>rsStreamNotFound</code> exception from the method. I've tried the two different lines of code below after setting the parameters. I'm interfacing with SQL Server 2005 and SSRS 2005. I've seen articles about a hotfix for this issue, but I'd really rather not resort to a hotfix, as I'm not sure that IT will be OK with it going in. There isn't too much documentation that I've found on the error which is </p>
  
  <blockquote>
    <p>The stream cannot be found. The stream
    identifier that is provided to an
    operation cannot be located in the
    report server database.report server database.</p>
  </blockquote>
  
  <p>Prep Code:</p>
  
  <pre><code>string mimeType;
  string encoding;
  List&lt;ReportParameter&gt; parameters = new List&lt;ReportParameter&gt;();
  string startDateValue = Request.Form[startDate.UniqueID];
  
  string endDateValue = Request.Form[endDate.UniqueID];
  parameters.Add(new ReportParameter("Owner", "5", false));
  parameters.Add(new ReportParameter("StartDate", startDateValue, false));
  parameters.Add(new ReportParameter("EndDate", endDateValue, false));
  ReportViewer1.ServerReport.SetParameters(parameters);
  </code></pre>
  
  <p>Call 1:</p>
  
  <pre><code>byte[] result = ReportViewer1.ServerReport.RenderStream("PDF", string.Empty, string.Empty, out mimeType, out encoding);
  </code></pre>
  
  <p>Call 2:</p>
  
  <pre><code>byte[] result = ReportViewer1.ServerReport.RenderStream("CSV", string.Empty, string.Empty, out mimeType, out encoding);
  </code></pre>
  
  <p>Clean up:</p>
  
  <pre><code>Response.Clear();
  Response.ContentType = mimeType;
  Response.ContentEncoding = System.Text.Encoding.GetEncoding(encoding);
  Response.OutputStream.Write(result, 0, result.Length);
  </code></pre>
  
  <p>Any thoughts on a solution? The end goal is to write this out to CSV for a download. In reality I'd be happy with XML that I'd translate to CSV.report server database.</p>