Is there a way to complete the post back after writing out a file to the Response?

被刻印的时光 ゝ 提交于 2019-12-06 01:59:22

It sounds like you're trying to make the response contain two parts: the page and the PDF. You can't do that. Typically download pages start a download as a separate request when you've gone to them (via JavaScript, I believe), with a direct link just in case the JavaScript doesn't work.

Any one HTTP request can only have one response.

Matthew

Response.End() literally ends the entire response.

There are two methods that I employ when I use it:

1) Always make sure it's the final required point in the postback.

2) (and the only way to use AJAX for file calls) Make a small page in an iframe solely for the purpose of sending files and call a refresh on the frame... the response.end will just end the response from that frame, not the entire postback.

EDIT: Here's my question thread on the same topic Using Response.TransmitFile for physical file not working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!