how create a Controller partial class to override OnAuthorization?

Posted by kaijk on Stack Overflow See other posts from Stack Overflow or by kaijk
Published on 2010-04-26T12:31:59Z Indexed on 2010/04/26 12:33 UTC
Read the original article Hit count: 780

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc