Search code examples
asp.net-web-apiaction-filter

Getting the HttpActionExecutedContext Result values


I have created a filter which inherits the System.Web.Http.Filters.ActionFilterAttribute in the asp.net web api and would like to access some of the data inside the HttpActionExecutedContext result object.

At what stage/when does this object get populated? As I looked at it when overriding the OnActionExecuted method and its always null?

Any ideas?

Edit:

for example here in my custom filter:

public override OnActionExecuted(HttpActionExecutedContext context)
{
    //context.Result.Content is always null

    base.OnActionExecuted(context);
}

Solution

  • Ended up using ReadAsStringAsync on the content result. I was trying to access the property before the actual request had finished.