Public static string Post (url string, the string content)
{
The string result="";
HttpWebRequest the req=(HttpWebRequest) WebRequest. Create (url);
The req. Method="POST";
The req. ContentType="application/x - WWW - form - urlencoded";
# region add Post parameter
Byte [] data=https://bbs.csdn.net/topics/Encoding.UTF8.GetBytes (content);
The req. ContentLength=data. Length;
Using (Stream reqStream=the req. GetRequestStream ())
{
ReqStream. Write (data, 0, the data Length);
ReqStream. Close ();
}
# endregion
HttpWebResponse resp=(HttpWebResponse) the req. The method GetResponse ();
The Stream Stream=resp. GetResponseStream ();
//get response content
Using (StreamReader reader=new StreamReader (stream, Encoding UTF8))
{
Result=reader. ReadToEnd ();
}
return result;
}
<meta charset="utf-8" & gt;
<body>Test: & lt; Input type="text" name="fname" & gt;