Old answers recommend an extra SOCKS handler because they target an older .NET networking stack. A modern supported .NET HTTP stack can use documented SOCKS proxy URI schemes.

var handler = new HttpClientHandler
{
    Proxy = new WebProxy("socks5://203.0.113.10:1080"),
    UseProxy = true
};
using var client = new HttpClient(handler);

The endpoint is illustrative. The SOCKS5 proxy list provides public candidates for this socks5 WebProxy URI; use the version supported by the actual handler. Check the target framework, runtime, platform, and actual handler used by the application before applying this example to an older .NET Framework process.

Microsoft's current proxy documentation lists socks4, socks4a, and socks5. Those names describe protocol behavior. A port number alone does not choose the SOCKS version, and curl's socks5h spelling is not a universal URI scheme accepted by every client.

For an authenticated SOCKS5 service, configure credentials according to the handler's supported interface. SOCKS4 and SOCKS4a do not provide the same password authentication mechanism.

The destination URL stays unchanged. An HTTPS request still establishes and verifies destination TLS through the proxy path; adding SOCKS is not a reason to disable that verification.

Artihkkalat mat laktásit