public class MAttribute : IActionFilter
{
public void OnActionExecuted(ActionExecutedContext actionContext)
{
string searchData = "";
actionContext.Controller.ViewBag.SearchItem = searchData;
//object not included in the definition
}
}
當我覆蓋IActionFilter
,它提示'對象不包含在定義',所以如何設置ViewBag在IActionFilter MVC6
?如何在IActionFilter MVC6中設置ViewBag?
小澄清:你不「越權」的接口;你「執行」它。 (相對於從基類繼承,沒有現有的實現覆蓋。) – CrazyPyro