2016-01-13 224 views
0

我试图让我的modeltype是从控制器的在actionfilter操作返回型号类型响应。获取网页API过滤

我试图在actionExecutedContext.Response对象看,但我无法找到任何东西。

+0

你能后,你已经尝试过的任何代码? – ragerory

回答

0
public class FooFilter : ActionFilterAttribute { 
     public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { 
      var objectContent = actionExecutedContext.Response.Content as ObjectContent; 
      if (objectContent != null) { 
       var type = objectContent.ObjectType; //type of the returned object 
       var value = objectContent.Value; //holding the returned value 
      } 

     } 
    }