1234567891011121314151617181920212223 |
- using System.Net;
- using System.Net.Http;
- namespace BanTur.Core.Utility
- {
- public class HttpAccess
- {
- public static string Get(string url)
- {
- var clientHandler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All };
- var webProxy = DbAccess.Config.WebProxy;
- if (!string.IsNullOrWhiteSpace(webProxy))
- {
- clientHandler.Proxy = new WebProxy(webProxy);
- }
- using var client = new HttpClient(clientHandler);
- var content = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
- return content;
- }
- }
- }
|