[HttpPost] public string TestData() { try { //接收post传入的数据 var request = System.Web.HttpContext.Current.Request; byte[] requestData = new byte[request.InputStream.Length]; request.InputStream.Read(requestData, 0, (int)request.InputStream.Length); var jsonData = Encoding.UTF8.GetString(requestData); //string JsonData = jsonData.TrimStart('"').TrimEnd('"').Replace(@"\", ""); //dynamic m = JsonData.ToObject<dynamic>(); return jsonData; } catch (Exception ex) { throw ex; } }
标签:webApi,C#,request,jsonData,InputStream,requestData,JSON,ex,byte From: https://www.cnblogs.com/lijl/p/16635375.html