开发者

Asp.Net HttpHandler and jQuery Ajax call

开发者 https://www.devze.com 2023-01-16 03:28 出处:网络
These are 2 questions. The first one: I have an HttpHandler returning a zip file to download. I have this line of code:

These are 2 questions. The first one: I have an HttpHandler returning a zip file to download. I have this line of code:

context.Response.AppendHeader("content-disposition", "attachment; filename=myzipfile.zip");

The question is: should I declare the ContentType (application/zip) also ?

The second question is: I want to call this HttpHandler from a jQuery ajax call. I send parameters in json format. How should I declare th开发者_StackOverflowe contentType of the ajax call?

Thanks for your time.


The question is: should I declare the ContentType (application/zip) also ?

Yes.

I want to call this HttpHandler from a jQuery ajax call

Calling a server side script that returns binary zip stream using AJAX makes little sense as you won't be able to manipulate the response.

0

精彩评论

暂无评论...
验证码 换一张
取 消