Search code examples
asp.netsqlstreamingdatareader

stream large data to browser using ASP .net


I currently have a website written in classic asp that runs multiple queries against sql, agregates the querues and than pushes them out for display on a web browser. (Paging is not allowed) The issue is that the web server agregates all the query results before displaying which takes up a lot of memory for even one query. The easy fix for classic asp is to write to the response object from a stream.

For some reason I an unable to picture the equivalent in .net without requiring a service on the page of some type. I normally bind to listviews etc which is why I am probably stuck. So if I have a datareader from sql how can I stream that object out to the browser to have a small memory footprint? Do I have to manually call the response object and write out? That seems a little backwards. I think I'm just missing something easy.

Thanks.

Add on:

So what I am looking for is how to progressively stream data from a sql reader to the html page so as not to waste memory. Is that even possible in .net?


Solution

  • yea, I woudlnt see a problem with that. Turn off page buffering, and just use Response.Write