How to post JSON to a server using C#?

后端 未结 13 1793
臣服心动
臣服心动 2020-11-22 05:55

Here\'s the code I\'m using:

// create a request
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(url); request.KeepAlive = false;
request.Protoco         


        
13条回答
  •  萌比男神i
    2020-11-22 06:23

    var data = Encoding.ASCII.GetBytes(json);

    byte[] postBytes = Encoding.UTF8.GetBytes(json);

    Use ASCII instead of UFT8

提交回复
热议问题