How to make an HTTP get request with parameters

后端 未结 5 2204
故里飘歌
故里飘歌 2020-12-02 12:59

Is it possible to pass parameters with an HTTP get request? If so, how should I then do it? I have found an HTTP post requst (link). In that exampl

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 13:41

    My preferred way is this. It handles the escaping and parsing for you.

    WebClient webClient = new WebClient();
    webClient.QueryString.Add("param1", "value1");
    webClient.QueryString.Add("param2", "value2");
    string result = webClient.DownloadString("http://theurl.com");
    

提交回复
热议问题