Сценарии - Настройка Proxy для http клиента

Page / - Изменено Alexandr Fokin в 2023/11/11 13:13

Настройка Proxy для http клиента

Изменено Alexandr Fokin

в 2023/11/11 13:13

Оглавление

IWebProxy proxy = WebRequest.GetSystemWebProxy();
proxy.Credentials = CredentialCache.DefaultCredentials;

.ConfigurePrimaryHttpMessageHandler(
() =>
{
HttpClientHandler handler = new HttpClientHandler();
handler.UseProxy = true;
handler.DefaultProxyCredentials = CredentialCache.DefaultNetworkCredentials;
return handler;
}
)

Ссылки:

How should I set the default proxy to use default credentials?
https://stackoverflow.com/questions/299940/how-should-i-set-the-default-proxy-to-use-default-credentials

HttpClient and using proxy - constantly getting 407
https://stackoverflow.com/questions/29856543/httpclient-and-using-proxy-constantly-getting-407