file download by calling .ashx page

前端 未结 1 1995
遇见更好的自我
遇见更好的自我 2020-12-01 19:22

I\'m requesting .ashx page from Master page client side script (Jquery) which has a code to download a PDF file. When I debug it, I can see the execution of \"file download\

相关标签:
1条回答
  • 2020-12-01 20:16

    Your file is downloading, but you get it on javascript, on the data parameter of your call because you call it with Ajax.

    You use a handler - so ajax not needed here, and the most easy thing to do using javascript is that:

    window.location = "FileDownload.ashx?parametres=22";
    

    or with a simple link as

      <a target="_blank" href="FileDownload.ashx?parametres=22" >download...</a>
    

    Ah, and send the parameters via the url, you can not post them that way.

    You can also read: What is the best way to download file from server

    0 讨论(0)
提交回复
热议问题