mvc api 拦劫处理返回值

2021-01-10 20:31

阅读:563

标签:contex   base   rri   name   public   nbsp   ext   stat   value   

///


/// 重写回传的处理
///

///
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
// 
//if ( actionExecutedContext.ActionContext != null )
//{
// var mm = (actionExecutedContext.ActionContext.Response.Content as ObjectContent).Value;
 
//重新封装返回值
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ObjectContent(result.GetType(), result, new JsonMediaTypeFormatter())
};
actionExecutedContext.Response = response;
}
base.OnActionExecuted(actionExecutedContext);
}

mvc api 拦劫处理返回值

标签:contex   base   rri   name   public   nbsp   ext   stat   value   

原文地址:https://www.cnblogs.com/itclw/p/12290456.html


评论


亲,登录后才可以留言!