我正在尝试更改方法OnAuthorization
,以便它可用于任何应用程序......这样:
public partial class Controller
{
protected override void OnAuthorization(AuthorizationContext filterContext)
{
if ((string)(filterContext.RouteData.Values["action"]) == "test")
{
filterContext.Result = new HttpUnauthorizedResult();
}
}
}
但显示编译错误:
Controller.OnAuthorization(System.Web.Mvc.AuthorizationContext)':找不到合适的方法来覆盖
有人能帮我吗?