Logging of every action call in controller

If you want to log every action execution in the ASP.NET MVC application.

Instead of adding unnecessary logic ( to logging ) in each action. We can override method OnActionExecuting which belongs to the Contoller class. It is launched every time we enter the action.

Example.

In that way we can do whatever we want with information about what action in the controller was clicked from. If we add additional information – when and who. We can use this in some statistics or something else…

Leave a Reply

Your email address will not be published. Required fields are marked *