how create a Controller partial class to override OnAuthorization?
- by kaijk
I'm trying to change the method OnAuthorization, so that it is available for any application ... this way:
public partial class Controller
{
protected override void OnAuthorization(AuthorizationContext filterContext)
{
if ((string)(filterContext.RouteData.Values["action"]) == "test")
{
filterContext.Result = new HttpUnauthorizedResult();
}
}
}
but is showing the compilation error: ...Controller.OnAuthorization(System.Web.Mvc.AuthorizationContext)': no suitable method found to override
can someone help me?