How to POST data to ASP.NET HttpHandler?

前端 未结 6 728
无人及你
无人及你 2021-02-02 15:58

I am trying to send a large chunk of data over to a HTTP handler. I can\'t send it using GET because of the URL length limit so I decided to POST it instead. The problem is that

6条回答
  •  隐瞒了意图╮
    2021-02-02 16:51

    I was having the same problem, and eventually figured out that setting the content type as "json" was the issue...

    contentType: "application/json; charset=utf-8"
    

    That's a line some popular tutorials suggest you to add in the $ajax call, and works well with ASPx WebServices, but for some reason it doesn't for an HttpHandler using POST.

    Hard to catch since values in the query string work fine (another technique seen in the web, though it doesn't makes much sense to use POST for that).

提交回复
热议问题