Area-global filters in MVC 3

2020-03-18 20:45发布

Since it doesn't appear to be supported natively, what's the recommended way of implementing global filters on a per-area basis?

2条回答
一纸荒年 Trace。
2楼-- · 2020-03-18 21:23

You could use a custom IFilterProvider.

查看更多
再贱就再见
3楼-- · 2020-03-18 21:34

The reason it's not supported natively is because we want to discourage developers from doing it. Areas are not associated with controllers; they're associated with routes. We wanted to discourage developers from trying to apply authorization or other security-sensitive filters to areas since they can be bypassed.

See How can we set authorization for a whole area in ASP.NET MVC? for more information.

查看更多
登录 后发表回答