客户端调用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);//编码类型按实际需求

  

猜你喜欢

转载自www.cnblogs.com/dinggf/p/12324341.html
今日推荐