Friday, 15 April 2011

c# - Side actions not happening after Response.WriteFile() -



c# - Side actions not happening after Response.WriteFile() -

as per asp.net page, on click of button next actions should happen:

download file server

perform clean actions like

hide button set text label display label disable button etc.

now download part happens through next code:

response.clear(); response.buffer = true; response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment; filename="+strfilename+".pdf"); response.writefile(strbrowserpath);

and remaining actions (point 2) done after.

sadly, since response.clear()/response.writefile() used remaining server side actions not happening.

any alternatives? fixes this?

from moment utilize post action send file, at same time can not send , page changes (disable button, alter text, etc). there no fixes because there not problem, way works. have 1 pipeline send response back. inquire 1 http response , 1 http response, can not have both update page , file.

now, alternative. first of how going send file. suggest utilize handler parameters download.ashx?dhwoload=filea.pdf , after post update on page, phone call

window.location = "download.ashx?dhwoload=filea.pdf";

javascript, alternative link

<a href="download.ashx?dhwoload=filea.pdf">if file did not start download automatically click here</a>

and create work.

relative: what best way download file server error handling when downloading file asp.net web handler (.ashx)

c# asp.net .net

No comments:

Post a Comment