Sending large amount of data for Excel report to client
<p>MS VS 2008, ASp.Net 3.5. 
On the client side :
client selects start and end dates, report format as Excel, clicks "run report" button
On that click redirected to reportToExcel.aspx, in reportToExcel.aspx.vb in Page_Load event stored procedure is executed to retrieve report data :   </p>

<pre><code>oSQLDataReader = oSqlCommand.ExecuteReader()
</code></pre>

<p>Then:</p>

<pre><code>Response.ContentType = "application/ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=" + MyBase.UserSession.ReportName + ".xls")
</code></pre>

<p>Then Response.Write is used to write retrieved report data into Response object in XML format, like </p>

<pre><code>Response.Write("&lt;td&gt;" &amp; FormatColumnValue(oSQLDataReader.GetValue(I), arrColHeader(I + 1).ColumnFormat) &amp; "&lt;/td&gt;"), etc.  Last callis Response.End().
</code></pre>

<p>I know Response.End should not be used, I plan to substitute is with </p>

<pre><code>context.Response.Flush()
context.ApplicationInstance.CompleteRequest()
</code></pre>

<p>but I doubt it will improve response time.</p>

<p>Problem: on the client side take 6 mins to receive 32.5 MB of data. This is too long. 
How to reduce this time ?</p>

<p>As I understood so far: chuncking is not possible for Excel report and anyway client wants to receive Excel report as one and whole.
In order to use Response.TransferFile : Excel file has to be created first, then zipped to reduce amount of data to download, then downloaded. For this to work Excel should be installed on the server, which is not acceptable in our case.</p>

<p>Deliver data as csv to client is not acceptable: client will have to import it to Excel, which they would not like to do.</p>

<p>Stored procedure executed from SQL management studio shows inconsistent run times: from 12 secs to 4 mins.</p>

<p>So, are there any other ways to reduce report 'delivery' time to the client ?</p>

<p>Thank you for all replies</p>
