13
나는 매개 변수를 받아들이려고하는 ActionFilterAttribute
을 가졌지 만 그들을 넘겨 줄 수 없다.액션 필터 ActionParameters
내 작업 필터는 다음과 같습니다.
public class PreventAction : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.Result = new RedirectResult("Home/Index");
}
}
그리고 나는 내 행동을 그렇게 꾸미기도한다.
[PreventAction]
public ActionResult Ideas()
{
return View();
}
이제 매개 변수를 추가하여이 필터를 호출 할 수 있습니다.
[PreventAction(myParam1 = "1", myParam2 = "2")]
public ActionResult Ideas()
{
return View();
}
누구나 알고 계십니까?
+1 환상적인! 감사합니다. – griegs
도와 주셔서 감사합니다 :) – womp