I am writing a middleware in .net core 2.2. I want to get name of Action and Controller name in the middleware.
I can not use ControllerContext
because it not available at that time.
Here is solution in core 3.1 Read Controller and Action name in middleware .Net Core
public async Task Invoke(HttpContext context)
{
await LogRequest(context);
await LogResponse(context);
}
private async Task LogResponse(HttpContext context)
{
ServiceName = context ...
}