我正在使用HttpClient
. 问题是它似乎没有发送我提供的内容。服务器为此给了我一个错误,当我用 Fiddler 查看请求时,它没有显示应有的内容:
HttpContent content = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>> {
new KeyValuePair<string, string>("key1", "value1"),
new KeyValuePair<string,string>("key2","value2"),
new KeyValuePair<string,string>("key3","value3"),
new KeyValuePair<string,string>("key4", "value4"),
new KeyValuePair<string, string>("key5", "value5"),
new KeyValuePair<string, string>("key6", "value6")
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
content.Headers.ContentType.CharSet = "UTF-8";
HttpResponseMessage resposne = await client.PostAsync(new Uri("my_url"), content);
关于什么可能是错误的任何建议?