ForeverTools.Proxy 1.0.0

dotnet add package ForeverTools.Proxy --version 1.0.0
                    
NuGet\Install-Package ForeverTools.Proxy -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ForeverTools.Proxy" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForeverTools.Proxy" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ForeverTools.Proxy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ForeverTools.Proxy --version 1.0.0
                    
#r "nuget: ForeverTools.Proxy, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ForeverTools.Proxy@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ForeverTools.Proxy&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ForeverTools.Proxy&version=1.0.0
                    
Install as a Cake Tool

ForeverTools.Proxy

Premium proxy client for .NET with BrightData integration. Access residential, datacenter, ISP, and mobile proxies with geo-targeting, session management, and automatic rotation.

NuGet NuGet Downloads

Features

  • Multiple Proxy Types: Residential, Datacenter, ISP, and Mobile proxies
  • Geo-Targeting: Target by country, state, and city
  • Session Management: Sticky sessions for maintaining the same IP
  • Protocol Support: HTTP and SOCKS5 protocols
  • Easy Integration: Works with HttpClient, WebProxy, and dependency injection
  • Connection Testing: Built-in proxy testing and validation

Getting Your BrightData Credentials

This package requires a BrightData account. Choose the proxy type that best fits your needs:

Proxy Type Best For Get Started
Residential General scraping, geo-targeting, ad verification Get Residential Proxies
ISP Proxies Long sessions, account management, high stability Get ISP Proxies
Social Media Social platform automation, content access Get Social Media Proxies
SERP API Search engine scraping, SEO monitoring Get SERP API

After signing up, you'll need:

  • Customer ID: Found in your BrightData dashboard
  • Zone Name: The name of your proxy zone
  • Zone Password: The password for your zone

Installation

dotnet add package ForeverTools.Proxy

Quick Start

Basic Usage

using ForeverTools.Proxy;

// Create client with credentials
var client = new BrightDataClient("your-customer-id", "your-zone", "your-password");

// Make a request through the proxy
var html = await client.GetAsync("https://example.com");

// Or create an HttpClient for more control
using var httpClient = client.CreateHttpClient();
var response = await httpClient.GetAsync("https://example.com");

Using Environment Variables

// Set environment variables:
// BRIGHTDATA_CUSTOMER_ID, BRIGHTDATA_ZONE, BRIGHTDATA_PASSWORD

var client = BrightDataClient.FromEnvironment();

Geo-Targeting

Target by Country

// Get content as if from the US
var usContent = await client.GetFromCountryAsync("https://example.com", "us");

// Create an HttpClient for a specific country
using var ukClient = client.CreateHttpClientForCountry("gb");

Target by City

using ForeverTools.Proxy;

// Target specific city
var geoTarget = new GeoTarget
{
    Country = "us",
    State = "ny",
    City = "new_york"
};

using var nyClient = client.CreateHttpClient(geoTarget);
var content = await nyClient.GetStringAsync("https://example.com");

Using Predefined Locations

// Common locations are predefined for convenience
var usClient = client.CreateHttpClient(GeoTarget.Locations.UnitedStates);
var ukClient = client.CreateHttpClient(GeoTarget.Locations.UnitedKingdom);
var deClient = client.CreateHttpClient(GeoTarget.Locations.Germany);
var jpClient = client.CreateHttpClient(GeoTarget.Locations.Japan);

Proxy Types

Residential Proxies

Best for general web scraping and geo-targeting. Uses real residential IPs.

using var httpClient = client.CreateResidentialHttpClient();
// or with geo-targeting
using var usClient = client.CreateResidentialHttpClient(GeoTarget.ForCountry("us"));

Datacenter Proxies

Best for high-speed scraping and bulk requests.

using var httpClient = client.CreateDatacenterHttpClient();

ISP Proxies

Best for long sessions and account management. Combines residential trust with datacenter speed.

using var httpClient = client.CreateISPHttpClient();

Mobile Proxies

Best for mobile-specific content and social media.

using var httpClient = client.CreateMobileHttpClient();

Session Management

Maintain the same IP address across multiple requests using sessions:

// Create a session (same IP for up to 5 minutes)
using var session = client.CreateSession();

// All requests use the same IP
using var httpClient = session.CreateHttpClient();
await httpClient.GetAsync("https://example.com/page1");
await httpClient.GetAsync("https://example.com/page2");
await httpClient.GetAsync("https://example.com/page3");

// Check session validity
Console.WriteLine($"Session age: {session.Age}");
Console.WriteLine($"Still valid: {session.IsValid}");

Session with Geo-Targeting

// Create a session from a specific location
using var session = client.CreateSession(GeoTarget.ForCountry("de"));

Testing Your Proxy

// Test the proxy connection
var result = await client.TestProxyAsync();

if (result.Success)
{
    Console.WriteLine($"Proxy working!");
    Console.WriteLine($"External IP: {result.ExternalIp}");
    Console.WriteLine($"Country: {result.Country}");
    Console.WriteLine($"City: {result.City}");
    Console.WriteLine($"Response time: {result.ResponseTimeMs}ms");
}
else
{
    Console.WriteLine($"Proxy failed: {result.Error}");
}

Test Multiple Countries

var countries = new[] { "us", "gb", "de", "jp", "au" };
var results = await client.TestMultipleCountriesAsync(countries);

foreach (var result in results)
{
    Console.WriteLine($"{result.Country}: {(result.Success ? result.ExternalIp : result.Error)}");
}

Dependency Injection

Basic Registration

// In Program.cs or Startup.cs
services.AddForeverToolsProxy("customer-id", "zone", "password");

// Inject and use
public class MyService
{
    private readonly BrightDataClient _proxyClient;

    public MyService(BrightDataClient proxyClient)
    {
        _proxyClient = proxyClient;
    }

    public async Task DoWorkAsync()
    {
        var content = await _proxyClient.GetAsync("https://example.com");
    }
}

Configuration-Based Registration

// appsettings.json
{
    "Proxy": {
        "CustomerId": "your-customer-id",
        "Zone": "your-zone",
        "Password": "your-password",
        "DefaultCountry": "us",
        "TimeoutSeconds": 60
    }
}

// Registration
services.AddForeverToolsProxy(configuration);

Named HttpClient

// Register a named HttpClient with proxy
services.AddBrightDataHttpClient(
    "ProxiedClient",
    "customer-id",
    "zone",
    "password"
);

// Use via IHttpClientFactory
public class MyService
{
    private readonly IHttpClientFactory _factory;

    public MyService(IHttpClientFactory factory)
    {
        _factory = factory;
    }

    public async Task DoWorkAsync()
    {
        var client = _factory.CreateClient("ProxiedClient");
        var response = await client.GetAsync("https://example.com");
    }
}

Working with WebProxy

If you need a WebProxy instance for use with other libraries:

// Create a WebProxy
var webProxy = client.CreateWebProxy();

// Or with geo-targeting
var usProxy = client.CreateWebProxyForCountry("us");

// Use with any client that supports WebProxy
var handler = new HttpClientHandler { Proxy = webProxy, UseProxy = true };

Getting Raw Credentials

Access the raw proxy credentials for custom integrations:

var credentials = client.GetCredentials();

Console.WriteLine($"Host: {credentials.Host}");
Console.WriteLine($"Port: {credentials.Port}");
Console.WriteLine($"Username: {credentials.Username}");
Console.WriteLine($"Password: {credentials.Password}");
Console.WriteLine($"Proxy URL: {credentials.ProxyUrl}");

// Generate a curl command for testing
Console.WriteLine(credentials.ToCurlCommand("https://httpbin.org/ip"));

Configuration Options

var options = new ProxyOptions
{
    CustomerId = "your-customer-id",
    Zone = "your-zone",
    Password = "your-password",

    // Defaults
    DefaultProxyType = ProxyType.Residential,
    DefaultProtocol = ProxyProtocol.Http,
    DefaultCountry = "us",
    DefaultCity = null,
    DefaultState = null,
    TimeoutSeconds = 60,
    Host = "brd.superproxy.io"
};

var client = new BrightDataClient(options);

Error Handling

try
{
    var content = await client.GetAsync("https://example.com");
}
catch (HttpRequestException ex)
{
    Console.WriteLine($"Request failed: {ex.Message}");
}
catch (TaskCanceledException)
{
    Console.WriteLine("Request timed out");
}

Best Practices

  1. Reuse HttpClient: Create one HttpClient and reuse it for multiple requests to the same target.

  2. Use Sessions for Related Requests: When making multiple requests that should appear from the same IP, use sessions.

  3. Handle Timeouts: Proxy requests may be slower than direct requests. Configure appropriate timeouts.

  4. Rotate IPs When Needed: For scraping, create new clients without sessions to get fresh IPs.

  5. Target Appropriately: Use geo-targeting only when necessary to maximize your proxy pool.

Support

License

MIT License - see LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 123 12/12/2025