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?
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:
But this example does not work, how can I solve this problem?