Download File from C# through Web Method via Ajax call?

前端 未结 3 1861
天命终不由人
天命终不由人 2021-01-05 14:53

I have tried to download the file from the server through the webmethod but it has not work for me. my code as below

     [System.Web.Services.WebMethod()]
         


        
3条回答
  •  孤城傲影
    2021-01-05 15:18

    Instead of calling a Web Method it would be a better idea to use a generic handler (.ashx file) and put your code for downloading the file in the ProcessRequest method of the handler.

提交回复
热议问题