C# Httpclient

using System.Net.Http;
using System.Net.Http.Headers;


            HttpClient client =  new HttpClient();


            string guid = "XXXXXXXXXXXXX";


            var requestURL = "http://mkcloud.XXXXXXXXXXXX";
            var req = Newtonsoft.Json.JsonConvert.SerializeObject(new
            {
                token = "XXXXXXXXXXXXXXXX",
                projectId = XX,
                dpguid = guid
            });
            var contentStr = string.Empty;


            HttpResponseMessage response = null;
            response = client.PostAsync(requestURL, new StringContent(req)).Result;
            if (response != null)
            {
                    var resultValue = response.Content.ReadAsStringAsync().Result;
                    string strResponse = HttpUtility.UrlDecode(resultValue.ToString());
            }

你可能感兴趣的:(C#(1))