using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace U8AppMain { public static class HttpHelper { public static Task Post(string url, string strBody) { strBody = strBody ?? ""; using (HttpClient client = new HttpClient()) { var httpContent = new StringContent(strBody, Encoding.UTF8); httpContent.Headers.ContentType.MediaType = "application/xml"; httpContent.Headers.ContentType.CharSet = "utf-8"; HttpResponseMessage response = client.PostAsync(url, httpContent).Result; if (httpContent != null) httpContent.Dispose(); return response.Content.ReadAsStringAsync(); } } } }