Search code examples
c#asp.net-mvcaction-filter

Are there any action filters in your project you feel are a must-have?


I'm still not totally clear on why I would need to build custom action filters. Maybe a couple examples would help.

Are there any action filters in your project that you feel are a must-have? Maybe even so important that you re-use them across all your MVC projects?


Solution

  • I use a "Logging" Action Filter to log all calls to my controllers with a dump of the parameters - this can be very useful during third-party testing allowing me to see how/why/when people are interacting with the application.

    Although not an Action Filter, I also place a logging hook into my repositories that dumps the SQL generated by any Linq2SQL code ... again useful to see exactly what is being executed and when.