How to get Action and Controller name in ASP.Net Core MVC app? -


how action , controller names in asp.net mvc core rc1 application in startup.cs?

i want create middleware , log information (i want log detailed response database, need action , 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 action , controller names here.. 

you'll want inject iactiondescriptorcollectionprovider service middleware. that, can use property actiondescriptors.items list of actiondescriptor, has route values action. if cast controlleractiondescriptor, you'll have access controllername , actionname.


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -