public static string PostRequestTest(string content, string url, string contentType = "application/json") { try { var memStream = new MemoryStream(); var cc = Encoding.UTF8.GetBytes(content); var request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = contentType; memStream.Write(cc, 0, cc.Length); request.ContentLength = memStream.Length; var requestStream = request.GetRequestStream(); memStream.Position = 0; var tempBuffer = new byte[memStream.Length]; memStream.Read(tempBuffer, 0, tempBuffer.Length); requestStream.Write(tempBuffer, 0, tempBuffer.Length); requestStream.Close(); string responseTxt = string.Empty; WebResponse response = request.GetResponse(); using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) //Encoding.GetEncoding("gb2312") { responseTxt = reader.ReadToEnd(); } response.Close(); return responseTxt; } catch (Exception ex) { throw new Exception(ex.Message); } }