如何更改WebClient类的标题?

时间:2019-03-18 13:40:36

标签: asp.net-mvc

我正在尝试更改WebClient的标头,但它总是引发异常

The Content-Type header cannot be changed from its default value for this request

,我不知道如何解决。

我该如何解决?

//Webclient do the post to server.
WebClient wc = new WebClient();

//Header
wc.Headers["Content-Type"] = "application/x-www-form-urlencoded;charset=ISO-8859-1";  

0 个答案:

没有答案