mvc webapi 返回字符串自动加双引号

时间:2016-04-13 00:01:50   收藏:0   阅读:663

来自:http://www.cnblogs.com/David-Huang/p/4351023.html

返回字符串,突然碰到双引号号问题,幸亏有人解决了。

 

返回XMLDocument类型,默认会解析为json格式。返回字符串会默认加双引号。

  解决方法:返回HttpResponseMessage类型,自定义返回值类型。

  

HttpResponseMessage responseMessage =
                new HttpResponseMessage { Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "text/plain") };

原文:http://www.cnblogs.com/xcsn/p/5384954.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!