Skip to content

IActionContextAccessor being deprecated #712

@nickalbrecht

Description

@nickalbrecht

An announcement from a few weeks ago mentioned that IActionContextAccessor and ActionContextAccessor are being deprecated (starting with .NET 10), which SubresourceIntegrityTagHelper and its child classes make use of (as do a few other classes).

The recommended alternative looks like this, and only requires injecting IHttpContextAccessor

var httpContext = httpContextAccessor.HttpContext;
var endpoint = httpContext?.GetEndpoint();
var actionDescriptor = endpoint?.Metadata.GetMetadata<ActionDescriptor>();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions