zoukankan      html  css  js  c++  java
  • uwp ,win10 post json

    public static async Task<HttpResponseMessage> PostHttpstringrequest(string requesturl,string jsonstr)
    {
    var myClient = new HttpClient();
    var myRequest = new HttpRequestMessage(HttpMethod.Post, requesturl);
    // HttpContent content = new StringContent(@"{ ""url"": ""http://cili006.com/""}");
    HttpContent content = new StringContent(jsonstr);
    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
    // Send a request asynchronously continue when complete 
    myRequest.Content = content;
    //myRequest.Version = Version.Parse("1.1");

    //HttpContent content=
    //myRequest.Content=
    //// This property represents the client preference for the HTTP protocol version.
    //// The default value for UWP apps is 2.0.
    //Debug.WriteLine(myRequest.Version.ToString());
    var response = await myClient.SendAsync(myRequest);
    return response;
    //string streamcontent = await response.Content.ReadAsStringAsync();
    //return streamcontent;
    }
    }

  • 相关阅读:
    grpc(五)
    go的代码库
    grpc(四)
    grpc(三)
    grpc(二)
    grpc(一)
    java的泛型
    如何学习编程语言
    老男孩K8S集群部署(二)
    VMware虚拟机状态正常,但SecureCRT连接时显示超时的解决方法
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/4956357.html
Copyright © 2011-2022 走看看