客户端调用web api 的post请求,传入一个字符串时,用此方法获取此字符串。

 byte[] byts = new byte[HttpContext.Current.Request.InputStream.Length];

 HttpContext.Current.Request.InputStream.Read(byts, 0, byts.Length);
 string req = System.Text.Encoding.UTF8.GetString(byts);//编码类型按实际需求

  

posted @ 2020-02-17 23:22  凌心缘  阅读(668)  评论(0编辑  收藏  举报