postman xwwwformurlencoded .net 方式

using WebClient = System.Net.WebClient;

string sSendStr = "message=" + JsonHelper.SerializeObject(sendObj);
//string sResult = HttpHelper.WebApiHttpHelper.Post(System.Configuration.ConfigurationManager.AppSettings["TruckSysApiUrl"], sSendStr, false, true, BondexCas.UserInfo.Token);

WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
webClient.Headers.Add("Token", BondexCas.UserInfo.Token);
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
byte[] postData = Encoding.UTF8.GetBytes(sSendStr);
byte[] responseData = webClient.UploadData(System.Configuration.ConfigurationManager.AppSettings["TruckSysApiUrl"], "POST", postData);
string sResult = Encoding.UTF8.GetString(responseData);

原文地址:https://www.cnblogs.com/MSIKRUBY/p/15667199.html