How to get Action and Controller names in ASP.Net MVC Core RC1 Application in Startup.cs?
I want to create a middleware and log the information (I want to Log detailed response to my Database, so I need Action and Controller info.) after following code in configure method of startup.cs -
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=User}/{action=Index}/{id?}");
});
//Want to get Action and controller names here..
route middlewareto do that, you can't add amiddlewareafter it, it going to not be called.middleware, it does what you wanna do. You must use it beforeUseMcvin the stack. It works on response.