在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("开始访问网络"); GetData(); Console.WriteLine("结束访问"); Console.ReadKey(); } static async void GetData() { HttpClientHandler hander = new HttpClientHandler(); hander.AllowAutoRedirect = false; HttpClient httpClient = new HttpClient(hander); HttpResponseMessage response = null; // string NavigateUrl = "http://おまとめローン審査基準.com/%E3%82%AA%E3%82%B9%E3%82%B9%E3%83%A1%E3%81%AE%E3%81%8A%E3%81%BE%E3%81%A8%E3%82%81%E3%83%AD%E3%83%BC%E3%83%B3.php"; string NavigateUrl = "http://www.baidu.com"; Uri uri = new Uri(NavigateUrl); IdnMapping idn = new IdnMapping(); NavigateUrl = NavigateUrl.Replace(uri.Host, idn.GetAscii(uri.Host)); response = await httpClient.GetAsync(NavigateUrl); // string loction = httpClient.GetAsync(NavigateUrl).Result.Headers.Location.ToString(); if (response.IsSuccessStatusCode) { string responseBodyAsText = response.Content.ReadAsStringAsync().Result; Console.WriteLine(responseBodyAsText); } } } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论