.Net 4.0のimで、HttpClientを使用しようとしています。4.0ではサポートされなくなったが、引き続き使用できるという記事をいくつか読みました。アセンブリを含めましたSystem.Net.Http;
が、必要なパラメータをに提供できませんHttpClient
。どうすればこれを修正できるでしょうか?
エラーが発生している場所を太字で示しています。
using (HttpClient http = new **HttpClient("{0}/v1/dm/labels/{1}.xml", MI_API_URL**))
{
http.**TransportSettings**.Credentials = new NetworkCredential(apiusername, apipassword);
List<KeyValuePair<string, string>> parms = new List<KeyValuePair<string, string>>();
parms.Add(new KeyValuePair<string, string>("Status", "Wiped"));
HttpResponseMessage response = http.**Get**(new Uri("devices.xml", UriKind.Relative), parms);
response.EnsureStatusIsSuccessful();
responseoutput = response.Content.ReadAsString();
xdoc.LoadXml(responseoutput);