查看中为ASP.NET MVC2编写的示例代码,我注意到他们可以通过分别访问filterContext.ActionDescriptor和filterContext.ActionDescriptor.ControllerDescriptor来检查是否对当前操作或控制器应用了自定义属性:
public class ExitHttpsIfNotRequiredAttribute : FilterAttribute, IAuthorizationFilter(typeof(RequireHttpsAttribute), true