I think this is due to a misunderstanding of the response object and / or the basic structure of HTTP requests.
Your request: GET / buildXLS.aspx
Server 1 Answer: / * header information for file download * // * file data * /
Server 2 Answer: / * information for the listener for the HTML page * / <div> Update ... </div> / * file data * /
if you try to act as server 1, you cannot send any data back to the answer, but the file itself (and the corresponding headers). if you try to act as server 2, the page you load will be treated as HTML, and you will never see the file data, since the headers were written with the text / html instead of XLS. in fact, once you discard the answer for any reason, you can no longer write.
I see a situation where your script can work, but only as two interacting pages - page 1 shows a progress message, and then opens a new window, page 2. page 2 starts the XLS assembly, and then starts page 1 to hide when the message is completed . you now have two pages that correspond to the two sets of headers you are trying to send, instead of trying to send both HTML updates and start downloading files within the same response.
source share