码迷,mamicode.com
首页 > Web开发 > 详细

HttpClient SendAsync

时间:2020-06-09 13:09:08      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:ring   mes   wait   www   new   nbsp   oid   eth   status   

 static async void HttpClientSendAsync()
        {
            var client = new HttpClient(new HttpClientHandler { UseProxy = false });
            var request = new HttpRequestMessage(HttpMethod.Post, "http://www.albahari.com/EchoPost.aspx");
            request.Content = new StringContent("This is a test!");
            HttpResponseMessage response = await client.SendAsync(request);
            response.EnsureSuccessStatusCode();
            string result = await response.Content.ReadAsStringAsync();
            Console.WriteLine(result);
        }

 

HttpClient SendAsync

标签:ring   mes   wait   www   new   nbsp   oid   eth   status   

原文地址:https://www.cnblogs.com/Fred1987/p/13071759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!