Soenneker.Html.Client 11.0.1189

Prefix Reserved
dotnet add package Soenneker.Html.Client --version 11.0.1189
                    
NuGet\Install-Package Soenneker.Html.Client -Version 11.0.1189
                    
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="Soenneker.Html.Client" Version="11.0.1189" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Html.Client" Version="11.0.1189" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Html.Client" />
                    
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 Soenneker.Html.Client --version 11.0.1189
                    
#r "nuget: Soenneker.Html.Client, 11.0.1189"
                    
#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 Soenneker.Html.Client@11.0.1189
                    
#: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=Soenneker.Html.Client&version=11.0.1189
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Html.Client&version=11.0.1189
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Html.Client

Provides a cached, dependency-injection-friendly HttpClient for retrieving HTML.

Install

dotnet add package Soenneker.Html.Client

Register

using Soenneker.Html.Client.Registrars;

services.AddHtmlClientAsSingleton();

Use AddHtmlClientAsScoped() when each dependency-injection scope must own an independent client. Its cache is scoped as well, so disposing one scope cannot remove another scope's client.

Usage

using Soenneker.Html.Client.Abstract;

public sealed class PageLoader(IHtmlClient htmlClient)
{
    public async Task<string> Load(Uri uri, CancellationToken cancellationToken)
    {
        HttpClient client = await htmlClient.Get(cancellationToken);

        return await client.GetStringAsync(uri, cancellationToken);
    }
}

Get() lazily creates the client and reuses it for the registered service lifetime. The client has no base address or site-specific headers, so pass an absolute URI and configure each request as needed.

Let the dependency-injection container dispose IHtmlClient. If you construct it yourself, dispose the wrapper rather than the returned HttpClient.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Html.Client:

Package Downloads
Soenneker.Html.Parser

A utility library for HTML parsing related operations

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1189 69 12/3/2026
11.0.1188 65 12/3/2026
11.0.1187 65 12/3/2026
11.0.1186 71 12/3/2026
11.0.1185 63 12/3/2026
11.0.1184 60 12/2/2026
11.0.1183 69 12/2/2026
11.0.1182 64 12/2/2026
11.0.1181 58 12/2/2026
11.0.1180 75 12/2/2026
11.0.1179 68 12/2/2026
11.0.1178 84 12/2/2026
11.0.1177 105 12/1/2026
11.0.1176 98 12/1/2026
11.0.1175 84 12/1/2026
11.0.1174 114 12/1/2026
11.0.1173 108 11/30/2026
11.0.1172 127 11/30/2026
11.0.1171 110 11/30/2026
11.0.1170 109 11/29/2026
Loading failed

Update dependency Soenneker.Utils.HttpClientCache to 11.0.2188 (#1780)