是否可以通过 HTTP
get 请求传递参数?如果是这样,我应该怎么做?我找到了一个 HTTP
post requst ( link )。在该示例中,字符串 postData
被发送到网络服务器。我想使用 get 来做同样的事情。 Google 在 HTTP
get here 上找到了这个例子.然而,没有参数被发送到网络服务器。
最佳答案
我的首选方式是这样。它为您处理转义和解析。
WebClient webClient = new WebClient();
webClient.QueryString.Add("param1", "value1");
webClient.QueryString.Add("param2", "value2");
string result = webClient.DownloadString("http://theurl.com");
关于c# - 如何使用参数发出 HTTP get 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/514892/