FclEx.Http 2.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FclEx.Http --version 2.4.0
                    
NuGet\Install-Package FclEx.Http -Version 2.4.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="FclEx.Http" Version="2.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FclEx.Http" Version="2.4.0" />
                    
Directory.Packages.props
<PackageReference Include="FclEx.Http" />
                    
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 FclEx.Http --version 2.4.0
                    
#r "nuget: FclEx.Http, 2.4.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 FclEx.Http@2.4.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=FclEx.Http&version=2.4.0
                    
Install as a Cake Addin
#tool nuget:?package=FclEx.Http&version=2.4.0
                    
Install as a Cake Tool

FclEx.Http

HTTP, HTML, cookie, authentication, and web-client helpers for FclEx.

What Is Included

  • HttpService, HttpClientOptions, request handlers, retry helpers, and download/upload utilities.
  • HTTP action abstractions for JSON, JSONP, XML, HTML, and HTML file workflows.
  • AngleSharp helpers for parsing and querying HTML documents.
  • Cookie parsing and simple cookie models.
  • OAuth client-credentials token provider and authentication handler.
  • MIME type lookup helpers.
  • User-client abstractions for authenticated web clients and session-aware workflows.
  • Form data models and helpers for web form submission.
  • Source-generated HttpClientBuilder helper overloads.

Usage Notes

  • The action types wrap HTTP responses into OperationResult<T>.
  • When implementing custom actions, keep parsing and validation errors inside the action pipeline so callers can handle them consistently.
  • ASP.NET Core server-side helpers live in FclEx.AspNetCore.

Named Access Token Providers

Register a client-credentials provider for each authority and client identity. The overload without a name registers the default provider under the empty name.

services.AddHttpClient(nameof(ClientCredentialsTokenProvider));

services.AddClientCredentialsTokenProvider("captcha-a", options =>
{
    options.Authority = authA.Authority;
    options.ClientId = authA.ClientId;
    options.ClientSecret = authA.ClientSecret;
});

services.AddClientCredentialsTokenProvider("captcha-b", options =>
{
    options.Authority = authB.Authority;
    options.ClientId = authB.ClientId;
    options.ClientSecret = authB.ClientSecret;
});

services.AddHttpClient("captcha-api-a")
    .AddAuthenticationHandler("captcha-a", ["captcha.read"]);

services.AddHttpClient("captcha-api-b")
    .AddAuthenticationHandler("captcha-b", ["captcha.read"]);

The name passed to AddAuthenticationHandler selects the token provider; it is independent of the HttpClient name. Multiple clients can share a provider name, and their handlers can request different scopes. Each provider instance retains its discovery-document and access-token caches for the lifetime of the service provider. Re-registering a name replaces that name's previous provider factory or client-credentials configuration; registrations are not merged. The handler overload without a provider name selects the default provider.

AddAccessTokenProvider<TProvider> registers a custom IAccessTokenProvider in the same named registry. Its overload without a name targets the default provider. The corresponding TryAddAccessTokenProvider<TProvider> overloads, with or without a name, keep an existing registration; when no name is supplied they target the default provider.

Each AddClientCredentialsTokenProvider and AddClientCredentialsTokenProviderBy<TDependency> overload also has a corresponding TryAdd form. These keep an existing registration with the same name and do not invoke the options callback or resolve the dependency for the skipped registration. Names are compared ordinally and are case-sensitive. Registration callbacks run lazily, the first time that name is requested, and the selected provider is cached for the service-provider lifetime.

Client-credentials registrations also support options callbacks that receive IServiceProvider, options factories, and AddClientCredentialsTokenProviderBy<TDependency> overloads that resolve a registered dependency. Those provider-registration callbacks execute from the root service provider, so the dependency and any services they resolve must not be scoped. If scoped services are needed to configure handler options, use AddAuthenticationHandlerBy<TDependency>; its dependency is resolved from the HTTP handler scope.

For example, a custom provider can be registered and selected in the same way:

services.AddAccessTokenProvider<MyAccessTokenProvider>("custom", provider =>
    new MyAccessTokenProvider(provider.GetRequiredService<ITokenClient>()));

services.AddHttpClient("custom-api")
    .AddAuthenticationHandler("custom", ["api.read"]);

The registration factory owns the provider instance. Do not return an instance that is also registered for disposal by DI; if a provider implements IDisposable, it is disposed when the service provider is disposed. Register one provider per credential configuration and let the named factory cache it, so its discovery and token caches remain effective.

Client-credentials providers send discovery and token requests through the HTTP client named ClientCredentialsTokenProvider. Configure that named client if those requests need custom transport settings such as a proxy or timeout.

HTML Context Lifetime

Use HtmlActionContext.Document to access the parsed document; Element is obsolete and can be replaced with Document.DocumentElement. The default HTML action pipeline disposes the context after result conversion, including error and exception paths. Materialize values during GetResult; do not return document nodes or deferred queries over them. When constructing a context or calling CreateContext directly, dispose each successfully created context after use. Context copies share the same document. CSS selectors are evaluated against the document, so selectors such as html and :root can select the root element.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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 is compatible.  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 is compatible.  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 (9)

Showing the top 5 NuGet packages that depend on FclEx.Http:

Package Downloads
FclEx.Serilog

Serilog configuration helpers, enrichers, filters, formatters, and sinks.

FclEx.AspNetCore

ASP.NET Core helpers for requests, sessions, model state, endpoints, authorization, request buffering, decompression, and logging context.

AbpEx.Core

Extensions for abp(https://github.com/abpframework/abp)

FclEx.Slack

SlackNet registration, Slack API extensions, message builders, webhook helpers, and table-to-message formatting.

FclEx.NewRelic

New Relic agent helpers and NerdGraph NRQL client support.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.2 350 10/10/2026
2.4.1 289 10/8/2026
2.4.0 331 10/3/2026
2.3.9 322 9/27/2026
2.3.8 310 9/26/2026
2.3.7 315 9/24/2026
2.3.6 335 9/22/2026
2.3.5 322 9/22/2026
2.3.4 355 8/28/2026
2.3.3 402 8/22/2026
2.3.2 362 8/20/2026
2.3.1 360 8/19/2026
2.3.0 357 8/17/2026
2.2.9 420 7/18/2026
2.2.8 415 6/13/2026
2.2.6 359 6/8/2026
2.2.5 363 6/5/2026
2.2.4 359 6/5/2026
2.2.3 385 5/27/2026
2.2.2 352 5/26/2026
Loading failed