0

Is there a way to detect if a httphandler has started transmitting?

I'm trying to do large dynamic Excel Exports (in html table format). I can do this, but there's a long delay from the httphandler getting the message and starting the download. I have turned off the output buffer, so the delay seems to be waiting for the SQL server to dump the data into the sqldataset.

Anyways, I'd like to send the user to a new page, have the page display a message, and automatically close once the httphandler has started sending the file.

Is there a way to detect if the first file headers have been sent?

Many thanks in advance!

1 Answers1

1

I'd suggest building a normal(.aspx) landingpage with the message "Compiling the data, your download will begin shortly", and then redirecting the user to the handler for the actual download. That way, you'll handle the possible delay between clicking the download link and the data arriving where the user might think something is wrong.

Eric Johansson
  • 582
  • 2
  • 14
  • 1
    If you add content-disposition: inline to the headers, it will open the file "inline", ie replace the tab with the content that was just downloaded. I know this works for pdfs atleast, not so sure with excel data, but it's worth a shot. – Eric Johansson Nov 19 '12 at 17:30
  • It's actually probably up to Excel needing an entire complete dataset before starting to display anything. Which means you can't do a spreadsheet that will "appear" on screen as the download is progressing, like images. – Eric Johansson Nov 20 '12 at 08:38