Using action parameters in custom Authorization Attribute in ASP.NET MVC3
问题 I have a controller which should only request authorization when loaded with specific parameters. Like when the parameter ID is 8 for example. I came up with using a custom validation attribute like this: public class MyAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) { if (/* Action's inputparameter ID = 8 */) { return base.AuthorizeCore(httpContext); } return true; } } My action looks like this (not that it is interesting)