Install
.NET 8 or newer. Everything here is in the base library; a console project is enough to try it.
dotnet new console -n MonkeyProxyRotating residential
PooledConnectionLifetime = TimeSpan.Zero stops the pool reusing a connection, so every request through this one client opens a new tunnel through the residential gateway and gets a new address. The client itself is still created once, which avoids running out of local ports.
using System.Net;
var handler = new SocketsHttpHandler
{
Proxy = new WebProxy("http://resi.proxymonkey.io:8000")
{
Credentials = new NetworkCredential("USER", "PASS"),
},
PooledConnectionLifetime = TimeSpan.Zero,
ConnectTimeout = TimeSpan.FromSeconds(10),
};
using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) };
for (var i = 0; i < 3; i++)
{
Console.WriteLine(await client.GetStringAsync("https://httpbin.org/ip"));
}A static datacenter or ISP IP
On a static datacenter IP, let the pool reuse connections; a lifetime of a few minutes still recycles them now and then. For an ISP order, use the host and port from your dashboard.
using System.Net;
var handler = new SocketsHttpHandler
{
Proxy = new WebProxy("http://IP:PORT")
{
Credentials = new NetworkCredential("USER", "PASS"),
},
PooledConnectionLifetime = TimeSpan.FromMinutes(5),
ConnectTimeout = TimeSpan.FromSeconds(10),
};
using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) };
foreach (var url in new[] { "https://httpbin.org/ip", "https://httpbin.org/headers" })
{
using var response = await client.GetAsync(url);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine($"{(int)response.StatusCode} {body[..Math.Min(80, body.Length)]}");
}Keeping one identity
With a normal pool lifetime, requests to one host reuse a tunnel and keep its exit address until the connection is recycled or idles out (PooledConnectionIdleTimeout). Cookies live in the handler's CookieContainer, shared by everything sent through that client. For two identities, use two handlers; for a residential address that holds across new connections, use a sticky session, whose setting for your account is in the dashboard.