WebClient set headers

后端 未结 4 986
栀梦
栀梦 2021-01-07 16:34

How I can set a header in the webClient class? I tried:

client.Headers[\"Content-Type\"] = \"image/jpeg\";

that throws a

4条回答
  •  天涯浪人
    2021-01-07 16:45

    You cannot change the Content-Type if you use the UploadValues method, it must be application/x-www-form-urlencoded, see webclient source code

提交回复
热议问题