1

I am using proxies in my HttpClient for my c# program. here is the code :

string proxy = "ip:port";
            var parsedProxy = proxy.Split(':');
            var handler = new HttpClientHandler
            {
                UseProxy = true,
                UseDefaultCredentials = false,
                UseCookies = true,
                AllowAutoRedirect = false,
                Proxy = new WebProxy(parsedProxy[0], int.Parse(parsedProxy[1])),
            };
            var client = new HttpClient(handler);

Then, every request made with this client uses the proxy. However, I can only put HTTP proxies in. How can I put socks4/socks5 proxies into it ?

RedOmega87
  • 11
  • 1
  • Looks like support for it will be included in .NET 6: https://github.com/dotnet/runtime/pull/48883 If you have Preview 5 or newer installed, you should be able to use it – Cheesebaron Aug 17 '21 at 18:02
  • seems question duplicaed https://stackoverflow.com/questions/43293365/c-sharp-httpclient-tor-socks4-5-proxy – Serg Shevchenko Aug 17 '21 at 19:02

0 Answers0