I need to check if certain HTTPS proxies are working。
somebody has used the following code to use the HTTPS proxy successfully
var proxy = new WebProxy
{
Address = new Uri($"https://proxy-server:port"),
BypassProxyOnLocal = false,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
userName: "user",
password: "Pass")
};
// Create a client handler that uses the proxy
var httpClientHandler = new HttpClientHandler
{
Proxy = proxy,
};
// Disable SSL verification
httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
// Finally, create the HTTP client object
var client = new HttpClient(handler: httpClientHandler, disposeHandler: true);
var result = await client.GetStringAsync("path");
Console.WriteLine(result);