Integrations / Language
Use Proxys with C# (.NET)
Use Proxys with HttpClient in .NET.
Steps
- Create a WebProxy with credentials and pass it to an HttpClientHandler.
var proxy = new WebProxy("http://gw.proxys.co:8000") {
Credentials = new NetworkCredential("USERNAME-country-us", "PASSWORD")
};
using var client = new HttpClient(new HttpClientHandler { Proxy = proxy, UseProxy = true });
Console.WriteLine(await client.GetStringAsync("https://ipinfo.io/json"));Before you start
Replace USERNAME and PASSWORD with a sub-user's credentials from the dashboard. Change -country-us to the country you need, or remove it for a random location. See targeting options for city, ASN and sticky sessions.