0

I can never seem to find any docs on .net, and the official ones (when they're correct) are a hopeless maze.

I redirect a user with jQuery to an HttpHandler on a new page where I build and send an html table (and call it an excel file) on the fly. I can build and send the file with no delay (even huge ones) thanks to stackers.

I'd like to tell the user on the new page that I'm building the file, etc as the file is being built and sent.

When I do context.response.write before sending my excel headers, I get:

Server Error in '/' Application.

Server cannot append header after HTTP headers have been sent.

Is there any way to achieve what I want?

Many thanks in advance!

2 Answers2

0

What exactly are you trying to achieve? As far as I understand you are building some kind of an excel sheet and send it to the client. I assume that for the client to recognize your content as an excel sheet you try to send some response headers (such as the mime-type).

Although you have to always send any kind of headers before the body, you won't be able to write a notification in the response stream that is shown to the user because the user would also save your notification to the excel file.

So I think you will need a new landing page with a notification on it and some kind of javascript or meta redirection (or else a hyperlink or button) to the url that forces the excel creation and download.

Peit
  • 882
  • 6
  • 17
0

What you need is a temporary landing page which redirects to the download page.

On the temp page you can have your message and a small script to send the user to the download.

<body>
<div> Your file is getting created... Please wait patiently.
</div>
<script>
    window.location.href = 'http://yoursite.com/documentpage/blah/foo/bar';
</script>
</body>
bluetoft
  • 5,373
  • 2
  • 23
  • 26