ActionDescriptor.ActionParameters in ActionExecutedContext

ActionExecutedContextIs there something like a property in the class ActionExecutingContext ActionDescriptor.ActionParameters?

I need to examine the action parameters at this stage ( OnActionExecuted).

+3
source share
2 answers

You can get parameters and values ​​like this:

// Format the parameters based on our requirements: 
StringBuilder parameters = new StringBuilder();
foreach (var p in filterContext.ActionDescriptor.GetParameters())
{
     if (filterContext.Controller.ValueProvider.GetValue(p.ParameterName) != null)
     {
           parameters.AppendFormat("\r\n\t{0}\t\t:{1}", p.ParameterName,
                       filterContext.Controller.ValueProvider.GetValue(p.ParameterName).AttemptedValue);
     }
}
+5
source

Do you want to use the method ActionExecutedContext.ActionDescriptor.GetParameters()? AFAIK there is no such property ActionDescriptor.ActionParameters. Is it because there is a derived class in your code ActionDescriptor?

0
source

All Articles