Make POST() With JSON

This question already has an answer here:

  • How to post JSON to the server? 11 answers

  •         var request = WebRequest.CreateHttp(myUrl + "/" + uri);
            request.Credentials = new NetworkCredential(myUserName, myPassword, myDomain);
            request.ContentType = "application/json; charset=utf-8";
            request.Method = "POST";
    
            using (StreamWriter streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                string jsonstring = JsonConvert.SerializeObject(myJsonobject, Formatting.Indented);
    
                streamWriter.Write(jsonstring);
    
                streamWriter.Flush();
            }
    

    看上面

    链接地址: http://www.djcxy.com/p/45868.html

    上一篇: HttpClient不支持PostAsJsonAsync方法C#

    下一篇: 使用JSON进行POST()