.NET library for HTTP/2 HTTP/3 requests with TLS fingerprinting support. Based on bogdanfinn/tls-client, it allows you to mimic various browser fingerprints to bypass bot protection.
dotnet add package Http.TLSDownload the appropriate native library for your platform from the bogdanfinn/tls-client releases page.
Initialization:
// Initialize once at application startup, dispose on shutdown
using var context = new NativeClientContext("path/to/native-library");
// For AOT builds, register your JsonSerializerContext for custom types
// context.RegisterContext(AppJsonSerializerContext.Default);using var context = new NativeClientContext("tls-client-windows-64-1.14.0.dll");
using var client = new RequestClientBuilder()
.WithBrowserType(BrowserType.Chrome133)
.WithTimeout(TimeSpan.FromSeconds(30))
.Build();
var request = new RequestBuilder()
.WithUrl("https://httpbin.org/get")
.Build();
var response = await client.SendAsync(request);
Console.WriteLine($"Status: {response?.Status}");
Console.WriteLine($"Body: {response?.Body}");Fluent API for client configuration:
using var client = new RequestClientBuilder()
.WithBrowserType(BrowserType.Chrome133)
.WithTimeout(TimeSpan.FromSeconds(30))
.WithProxy("http://proxy:8080")
.WithCookieJar(true)
.WithDebug(true)
.Build();Available methods:
WithBrowserType()- browser fingerprint selectionWithTimeout()- request timeoutWithProxy()- proxy configurationWithCookieJar()/WithoutCookieJar()- cookie managementWithInsecureSkipVerify()- skip SSL verification- ...
Factory for managing multiple named client configurations:
var factory = new RequestClientFactory(o => o.BrowserType = BrowserType.Chrome133);
factory.Register("mobile", o => o.BrowserType = BrowserType.SafariIos17_2);
using var defaultClient = factory.CreateClient();
using var mobileClient = factory.CreateClient("mobile");
using var customClient = factory.CreateClient(o => o.WithProxy("http://proxy:8080"));Fluent API for request creation:
var request = new RequestBuilder()
.WithUrl("https://api.example.com/data")
.WithMethod(HttpMethod.Post)
.WithBody(new { name = "John", age = 30 })
.WithHeader("Authorization", "Bearer token")
.WithTimeout(TimeSpan.FromSeconds(30))
.Build();Available methods:
WithUrl()- request URLWithMethod()- HTTP methodWithBody()- request body (string, object, byte[])WithHeader()/WithHeaders()- headersWithCookie()/WithCookies()- cookies- ...
- HTTP/1.1, HTTP/2, HTTP/3 - Full protocol support with automatic negotiation
- Protocol Racing - Chrome-like "Happy Eyeballs" for HTTP/2 vs HTTP/3
- TLS Fingerprinting - Mimic Chrome, Firefox, Safari, and other browsers
- HTTP/3 Fingerprinting - Accurate QUIC/HTTP/3 fingerprints matching real browsers
- Custom Header Ordering - Control the order of HTTP headers
- Proxy Support - HTTP and SOCKS5 proxies
- Cookie Jar Management - Built-in cookie handling
- Certificate Pinning - Enhanced security with custom certificate validation ...
var request = new RequestBuilder()
.WithUrl("https://httpbin.org/get")
.WithMethod(HttpMethod.Get)
.Build();
var response = await client.SendAsync(request);var request = new RequestBuilder()
.WithUrl("https://httpbin.org/post")
.WithMethod(HttpMethod.Post)
.WithBody(new { name = "John", age = 30 })
.Build();
var response = await client.SendAsync(request);- .NET Standard 2.0
- .NET 5.0, 6.0, 8.0, 9.0, 10.0