[英]OnActionExecuted: no suitable method found to override
I am getting an error
我收到一个error
OnActionExecuted: no suitable method found to override OnActionExecuted:找不到适合的方法来覆盖
public override void OnActionExecuted(ActionExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetNoStore();
}
I want to execute this code after method execution. 我想在方法执行后执行此代码。
Here is the method signatures : 这是方法签名:
protected virtual void OnActionExecuted (System.Web.Mvc.ActionExecutedContext filterContext);
You have incorrect type of parameter in your override. 您的替代中参数类型错误。 It expects a parameter of type ActionExecutedContext
not ActionExecutingContext
. 它期望类型为ActionExecutedContext
的参数而不是ActionExecutingContext
。 See OnActionExecuted 参见OnActionExecuted
It should be: 它应该是:
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
// code goes here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.