Getting the HttpActionExecutedContext Result values

gdp picture gdp · Apr 23, 2012 · Viewed 14.6k times · Source

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);
}

Answer

gdp picture gdp · May 15, 2012

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