Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionDescriptor.ActionParameters in ActionExecutedContext

There is any thing like the ActionExecutingContext's ActionDescriptor.ActionParameters property in the ActionExecutedContext class?

I need to investigate the action's parameters at this stage(OnActionExecuted).

like image 692
Yair Nevet Avatar asked Oct 12 '25 15:10

Yair Nevet


1 Answers

You can get the parameters and the values like so :

// 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);
     }
}
like image 108
basarat Avatar answered Oct 14 '25 05:10

basarat