使用JSON进行POST()

这个问题在这里已经有了答案:

  • 如何发布JSON到服务器? 11个答案

  •         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/45867.html

    上一篇: Make POST() With JSON

    下一篇: Consume Rest Webservice with json body request