Skip to content

How to determine the corresponding Action to a route in a middleware #321

@erlimar

Description

@erlimar

I am writing a middleware, and accurate routing of services. I need to run this middleware before running the MVC, for the corresponding Action the route of HttpContext.

Something like:

public async Task Invoke(HttpContext context, IServiceProvider services)
{
    var routes = services.GetService<IRouteCollection>();
    // ???
    await _next (context);
}

But this example does not work, how can I solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions