uwp ,win10 post json

public static async Task<HttpResponseMessage> PostHttpstringrequest(string requesturl,string jsonstr)
{
var myClient = new HttpClient();
var myRequest = new HttpRequestMessage(HttpMethod.Post, requesturl);
// HttpContent content = new StringContent(@"{ ""url"": ""http://cili006.com/""}");
HttpContent content = new StringContent(jsonstr);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
// Send a request asynchronously continue when complete 
myRequest.Content = content;
//myRequest.Version = Version.Parse("1.1");

//HttpContent content=
//myRequest.Content=
//// This property represents the client preference for the HTTP protocol version.
//// The default value for UWP apps is 2.0.
//Debug.WriteLine(myRequest.Version.ToString());
var response = await myClient.SendAsync(myRequest);
return response;
//string streamcontent = await response.Content.ReadAsStringAsync();
//return streamcontent;
}
}

posted on 2015-11-11 16:29  GIS-MAN  阅读(678)  评论(0编辑  收藏  举报

导航