Skip to content

Update Blazor HttpClient/HttpClientFactory guidance for accessing scoped services in DelegatingHandler #36562

@javiercn

Description

@javiercn

[EDIT by guardrex to add the metadata]

This is a follow-up to dotnet/aspnetcore#59440.

Please update the Blazor documentation guidance for using HttpClient and IHttpClientFactory to cover the pattern for accessing scoped services (like AuthenticationStateProvider) from a DelegatingHandler.

The current documentation doesn't address the handler scope isolation issue where handlers created by IHttpClientFactory run in a separate DI scope that doesn't share services with the Blazor circuit.

A sample implementation using Keyed DI is available at: https://github.com/javiercn/blazor-httpclientfactory-sample


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

P0/P1 - High Priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions