📜  如何发布请求 C# 并返回 responsebody - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:39.781000             🧑  作者: Mango

代码示例1
using(WebClient client = new WebClient())
{
    var reqparm = new System.Collections.Specialized.NameValueCollection();
    reqparm.Add("param1", " kinds & of = ? strings");
    reqparm.Add("param2", "escaping is already handled");
    byte[] responsebytes = client.UploadValues("http://localhost", "POST", reqparm);
    string responsebody = Encoding.UTF8.GetString(responsebytes);
}