asp.net - Download file from server -


i have asp.net/c# page. has textbox accept user input. data processed on server , file generated , saved.

initially transmitted file client using response.transmitfile(). however, process disables javascript on page when file downloaded.

therefore, have designed .ashx handler download file.

now, there 2 buttons on page. user clicks on 1 process , create file. once page postbacks, other button enabled , should clicked download file (invoke handler).

what want know how can wire button call handler?

note: need send parameter handler query string. parameter available in code behind.

if want button, request, take approach:

aspx:

<asp:button id="btndownloadfile" runat="server" onclick="btndownloadfile_click" /> 

code-behind:

protected void btndownloadfile_click(object sender, eventargs e) {     response.redirect(string.format("/file.ashx?id={0}", myparameter); } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -