标签:style blog http color 使用 line
HttpRequestMessage http_req_msg = new HttpRequestMessage(); http_req_msg.Method = HttpMethod.Get; http_req_msg.Headers.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"); http_req_msg.RequestUri = new Uri("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl"); HttpClient httpclient; HttpClientHandler httphandler; httphandler = new HttpClientHandler(); httphandler.AllowAutoRedirect = false; httphandler.UseCookies = false; httpclient = new HttpClient(httphandler); var task = httpclient.SendAsync(http_req_msg); task.Result.EnsureSuccessStatusCode(); HttpResponseMessage response = task.Result; var result = response.Content.ReadAsStringAsync(); string responseBodyAsText = result.Result; responseBodyAsText = responseBodyAsText.Replace("<br>", Environment.NewLine); // Insert new lines MessageBox.Show(responseBodyAsText);
使用HttpClient发送GET请求,布布扣,bubuko.com
标签:style blog http color 使用 line
原文地址:http://www.cnblogs.com/lijiu/p/3834296.html