Reputation: 8189
This is sort of a broad question, but one I am curious about.
What are some examples of uses for MVC Global filters? I.E.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new CustomFilterAttribute());
}
I have seen many examples of stopwatches which while perfectly legitimate, lacks much real use.
I have also seen a few logging examples which is good, but I was wondering if anyone has any other thoughts on what to implement them for, or places you have used them.
Upvotes: 0
Views: 997
Reputation: 30152
Most importantly in my opinion is security. You can have security applied to everything by default using a global action filter.
Global injecting of content - html or headers for example.
Upvotes: 1