ASP.Net Core RRS feed

  • Question

  • User-1361433004 posted

    How do I get action argument and response from ActionExecutedContext? I am using the following code

    public override void OnActionExecuted(ActionExecutedContext actionContext)


    var actionArguments = actionContext.ActionContext.ActionArguments;

    var response = ((ObjectContent)actionContext.ActionContext.Response.Content).Value as ResponseBase;


    Wednesday, January 27, 2021 11:41 AM

All replies

  • User753101303 posted


    Ypu tried actionContext.Result and actionContext.RouteData ?

    Wednesday, January 27, 2021 3:44 PM
  • User-474980206 posted

    not clear what you are trying to do.

    to get the parameters in OnActionExecuting

       var args = context.ActionArguments;

    each arg will have a name and value

    to get the action result its in the OnActionExecuted:

       var result = context.Result

    typically if you are calling a view this will be of type IActionResult. From this you can get the ViewBag and the Model that will be passed to the view.

    Wednesday, January 27, 2021 5:17 PM