Soenneker.Html.Client
11.0.1168
Prefix Reserved
dotnet add package Soenneker.Html.Client --version 11.0.1168
NuGet\Install-Package Soenneker.Html.Client -Version 11.0.1168
<PackageReference Include="Soenneker.Html.Client" Version="11.0.1168" />
<PackageVersion Include="Soenneker.Html.Client" Version="11.0.1168" />
<PackageReference Include="Soenneker.Html.Client" />
paket add Soenneker.Html.Client --version 11.0.1168
#r "nuget: Soenneker.Html.Client, 11.0.1168"
#:package Soenneker.Html.Client@11.0.1168
#addin nuget:?package=Soenneker.Html.Client&version=11.0.1168
#tool nuget:?package=Soenneker.Html.Client&version=11.0.1168
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Utils.HttpClientCache (>= 11.0.2164)
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.1168 | 106 | 11/19/2026 |
| 11.0.1167 | 94 | 11/18/2026 |
| 11.0.1166 | 105 | 11/18/2026 |
| 11.0.1164 | 97 | 11/18/2026 |
| 11.0.1163 | 129 | 11/15/2026 |
| 11.0.1162 | 108 | 11/15/2026 |
| 11.0.1161 | 137 | 11/11/2026 |
| 11.0.1160 | 118 | 11/11/2026 |
| 11.0.1158 | 95 | 11/11/2026 |
| 11.0.1157 | 106 | 11/11/2026 |
| 11.0.1156 | 109 | 11/11/2026 |
| 11.0.1155 | 178 | 11/3/2026 |
| 11.0.1154 | 109 | 11/3/2026 |
| 11.0.1153 | 117 | 11/3/2026 |
| 11.0.1152 | 113 | 11/3/2026 |
| 11.0.1151 | 144 | 10/27/2026 |
| 11.0.1150 | 126 | 10/27/2026 |
| 11.0.1148 | 110 | 10/26/2026 |
| 11.0.1147 | 106 | 10/26/2026 |
| 11.0.1145 | 112 | 10/26/2026 |
Updated Soenneker.Utils.HttpClientCache to 11.0.2164