Area-global filters in MVC 3

安稳与你 提交于 2019-12-01 02:10:32

问题


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


回答1:


You could use a custom IFilterProvider.




回答2:


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.



来源:https://stackoverflow.com/questions/5700295/area-global-filters-in-mvc-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!