zoukankan      html  css  js  c++  java
  • mvc api 拦劫处理返回值

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

  • 相关阅读:
    数据分析之Anaconda安装
    算法作业三
    算法作业二
    html
    qingdao
    hdu 123
    排序作业
    hdu 5614
    hdu 456
    poj 3140 树形去边差异最小
  • 原文地址:https://www.cnblogs.com/itclw/p/12290456.html
Copyright © 2011-2022 走看看