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);
}
}
这是可能的吗?