12
如何使用C#将JSON发布到服务器?
这是我正在使用的代码: // create a request HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version10; request.Method = "POST"; // turn our request string into a byte stream byte[] postBytes = Encoding.UTF8.GetBytes(json); // this is important - make sure you specify type this way request.ContentType = "application/json; charset=UTF-8"; request.Accept = …
269
c#
json
post
httpwebrequest