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;
    }
    }

  • 相关阅读:
    Python是如何进行内存管理的?
    scrapy利用set()对数据进行去重
    python快速抓取新闻标题及内容
    python爬虫第三方库
    Spring使用@Scheduled定时调度
    redis启动失败
    视图系统
    路由系统
    Django框架 part 2
    Django框架
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/4956357.html
Copyright © 2011-2022 走看看