3

を使用して簡単な呼び出しを行ってい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);

何が間違っている可能性があるかについて何か提案はありますか?

4

1 に答える 1