.NET Framework 使用System.Net.WebClient发送带有字符串有效负载的POST请求
示例
string requestUri = "http://www.example.com";
string requestBodyString = "请求正文字符串。";
string contentType = "text/plain";
string requestMethod = "POST";
byte[] responseBody;
byte[] requestBodyBytes = Encoding.UTF8.GetBytes(requestBodyString);
using (var client = new WebClient())
{
client.Headers[HttpRequestHeader.ContentType] = contentType;
responseBody = client.UploadData(requestUri, requestMethod, requestBodyBytes);
}
热门推荐
10 送礼祝福语简短有深意
11 送给妈妈新年祝福语简短
12 红包祝福语简短10字
13 忌日祝福语简短10字
14 经典座右铭简短祝福语英文
15 春节最好的祝福语简短
16 妹妹生日祝福语简短好看
17 夏季小孩生日祝福语简短
18 同事孩子上学祝福语简短