开发者

ASP.net MVC Global Filtering

开发者 https://www.devze.com 2023-03-10 13:58 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号