Integration

Use Shifter with C# / .NET

Wire Shifter's residential and ISP proxies into any .NET project — HttpClient, RestSharp, Flurl, Selenium, and Playwright — without touching your business logic.

Quick Start

Install

dotnet add package System.Net.Http

Basic Usage

using System.Net;
using System.Net.Http;

var proxy = new WebProxy("http://p.shifter.io:443") {
    Credentials = new NetworkCredential(
        "customer-USERNAME-country-us-sid-123ABC",
        "PASSWORD"
    )
};

var handler = new HttpClientHandler { Proxy = proxy, UseProxy = true };
using var client = new HttpClient(handler) {
    Timeout = TimeSpan.FromSeconds(30)
};

var json = await client.GetStringAsync("https://ipinfo.io/json");
Console.WriteLine(json);
// {"ip": "154.16.xxx.xxx", "city": "New York", "country": "US", ...}

Features

Drop-in support for HttpClient, RestSharp, Flurl, HttpWebRequest, and any .NET HTTP client that takes a WebProxy
Per-request rotation by default, with `sid` for sticky sessions and `ttl-N` for timed pins of N seconds
Headless browser support via Selenium WebDriver and Playwright for .NET
HTTP, HTTPS, and SOCKS5 protocols on the same gateway endpoint
Geo-targeting in 195+ countries via username parameters — no extra package required
Compatible with .NET 6, .NET 7, .NET 8, and .NET Framework 4.7.2+ — works with C#, F#, VB.NET

Examples

HttpClient with Sticky Session

The standard .NET HTTP client. Configure once, share across the app via IHttpClientFactory or a singleton — the same residential IP will be reused for every request with a matching `sid`.

using System.Net;
using System.Net.Http;

static HttpClient ShifterClient(string country, string city, string sid)
{
    var proxy = new WebProxy("http://p.shifter.io:443") {
        Credentials = new NetworkCredential(
            $"customer-USERNAME-country-{country}-city-{city}-sid-{sid}-ttl-300",
            "PASSWORD"
        )
    };

    var handler = new HttpClientHandler {
        Proxy = proxy,
        UseProxy = true,
        AutomaticDecompression = DecompressionMethods.All
    };

    var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) };
    client.DefaultRequestHeaders.Add("User-Agent",
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
    return client;
}

var c = ShifterClient("uk", "london", Guid.NewGuid().ToString("N")[..8]);

foreach (var path in new[] { "/login", "/dashboard", "/orders" })
{
    var resp = await c.GetAsync($"https://example.co.uk{path}");
    Console.WriteLine($"{path} {(int)resp.StatusCode} {(await resp.Content.ReadAsStringAsync()).Length}");
}

RestSharp

RestSharp wraps HttpClient with a fluent builder, automatic JSON deserialization, and retry policies. Configure the proxy on the RestClientOptions.

using RestSharp;
using System.Net;

public record Product(int Id, string Name, decimal Price);

var options = new RestClientOptions("https://api.example.de") {
    Proxy = new WebProxy("http://p.shifter.io:443") {
        Credentials = new NetworkCredential(
            "customer-USERNAME-country-de-sid-456DEF",
            "PASSWORD"
        )
    },
    Timeout = TimeSpan.FromSeconds(30)
};

var client = new RestClient(options);

var request = new RestRequest("/products");
request.AddHeader("User-Agent",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36");

var products = await client.GetAsync<List<Product>>(request);
foreach (var p in products!)
    Console.WriteLine($"{p.Id} {p.Name} — {p.Price:C}");

Selenium WebDriver (.NET)

Drive a real Chrome / Edge / Firefox instance through Shifter for JavaScript-rendered targets. Pair with Shifter's IP whitelist for headless authentication.

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Proxy = OpenQA.Selenium.Proxy;

var seleniumProxy = new Proxy {
    HttpProxy = "p.shifter.io:443",
    SslProxy  = "p.shifter.io:443"
};

var options = new ChromeOptions { Proxy = seleniumProxy };
options.AddArguments("--headless=new",
    "--user-agent=Mozilla/5.0 (Linux) AppleWebKit/537.36");

// For username-password auth in headless mode, pair with Shifter's
// IP whitelist or use selenium-wire — Chrome ignores credentials in
// headless mode without a sidecar extension.

using var driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://example.com");

var title = driver.Title;
var html  = driver.PageSource;
Console.WriteLine($"{title} — {html.Length} bytes");

Playwright for .NET

Microsoft Playwright drives Chromium, Firefox, and WebKit from C#. Configure the proxy in the launch options — credentials inline, no extension needed.

using Microsoft.Playwright;

using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new() {
    Proxy = new() {
        Server   = "http://p.shifter.io:443",
        Username = "customer-USERNAME-country-fr-city-paris-sid-789GHI",
        Password = "PASSWORD"
    }
});

var context = await browser.NewContextAsync(new() {
    UserAgent = "Mozilla/5.0 (Windows) AppleWebKit/537.36"
});

var page = await context.NewPageAsync();
await page.GotoAsync("https://example.fr");

var headlines = await page.Locator(".headline").AllTextContentsAsync();
foreach (var h in headlines)
    Console.WriteLine(h);
FAQ

Frequently asked FAQ questions

Common questions about using Shifter with C# / .NET.

Create a WebProxy pointing at `http://p.shifter.io:443` with Credentials set to a NetworkCredential containing your Shifter username and password. Pass it to an HttpClientHandler with UseProxy = true and feed that handler to a new HttpClient. The same client can safely be shared across the app via IHttpClientFactory.

Get started

Start Using Shifter with C# / .NET

Add Shifter's 205M+ residential and ISP proxies to your .NET stack in under 5 minutes. Works with HttpClient, RestSharp, Selenium, and Playwright.

Try Shifter for FreeSet up in minutes. Cancel anytime.