[英]Replace WebClient.UploadString() to HttpClient.PostAsync
[英]Webclient.UploadString() sends an empty string
这是一些代码:
var client = new WebClient();
client.BaseAddress = "http://localhost/";
client.Headers["Content-type"] = "application/x-www-form-urlencoded";
client.Proxy = null;
// The server gets the data
var responseStr = client.UploadString(url, data);
...
// The server gets an empty post data
responseStr = client.UploadString(url, data);
Webclient应该是一次性的吗?
嗯,你可能不能尝试这个:
WebClient client = new WebClient();
client.BaseAddress = "http://localhost/something.php";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.