Редактировал(а) Alexandr Fokin 2023/11/11 13:13

Скрыть последних авторов
Alexandr Fokin 2.1 1
2
3 {{code language="c#"}}
Alexandr Fokin 7.1 4 IWebProxy proxy = WebRequest.GetSystemWebProxy();
5 proxy.Credentials = CredentialCache.DefaultCredentials;
Alexandr Fokin 2.1 6 {{/code}}
Alexandr Fokin 6.1 7
Alexandr Fokin 5.1 8 {{code language="c#"}}
Alexandr Fokin 7.1 9 .ConfigurePrimaryHttpMessageHandler(
10 () =>
11 {
12 HttpClientHandler handler = new HttpClientHandler();
13 handler.UseProxy = true;
14 handler.DefaultProxyCredentials = CredentialCache.DefaultNetworkCredentials;
15 return handler;
16 }
17 )
Alexandr Fokin 5.1 18 {{/code}}
Alexandr Fokin 2.1 19
20
21 Ссылки:
Alexandr Fokin 3.1 22
23 How should I set the default proxy to use default credentials?
Alexandr Fokin 2.1 24 https://stackoverflow.com/questions/299940/how-should-i-set-the-default-proxy-to-use-default-credentials
Alexandr Fokin 3.1 25
Alexandr Fokin 4.1 26 HttpClient and using proxy - constantly getting 407
27 https://stackoverflow.com/questions/29856543/httpclient-and-using-proxy-constantly-getting-407