ASP.net MVC Global Filtering
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)
{
开发者_JAVA技巧 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.
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.
精彩评论