0
我有一個自定義過濾器屬性,我想在某些ActionResults上使用它來查看正在嘗試的數據並設置違反某些規則的值。在自定義過濾器屬性中更改ActionExecutingContext值
所以;
public class SpecialActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
foreach (string value in filterContext.Controller.ValueProvider.Keys)
{
string h = filterContext.Controller.ValueProvider[value].AttemptedValue;
if (h == "1")
{
//set the value of the key to be say "one".
}
}
base.OnActionExecuting(filterContext);
}
}
這是可能的嗎?