Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Get Controller Name and Action Name for Logging in Middleware (MVC6)

$
0
0

Hi !!

One of our requirement is to log action current user is trying to perform i.e. Log which controller/action he is invoking. To solve this cross cutting issue, I decided to implement Middleware approach in MVC 6. However I am not able to get the name of the controller and method name in my logging Middleware. Can someone guide me how to get access to that? 

I can see in output window that ASPNET5/MVC 6 is logging the controller name/action name as follows, so there is a way, but not sure how,

Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler: Information: Executed action WebAPI.Controllers.RequestsController.GetRequestBasic in 0.0593ms


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>