码迷,mamicode.com
首页 > Windows程序 > 详细

mvc api 拦劫处理返回值

时间:2020-02-10 13:34:45      阅读:74      评论:0      收藏:0      [点我收藏+]

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

/// <summary>
/// 重写回传的处理
/// </summary>
/// <param name="actionExecutedContext"></param>
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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!