How do I use WebClient to send NET/C-sharp data to a specified remote request address in the development of a (POST) application?

during the development of a .NET / C-sharp application, you need to use the WebClient class to send (HTTP POST) data to the specified remote request address.

of course, instead of using the class WebClient, we can use WebRequest to send HTTP requests, but if for certain reasons, we must use WebClient to handle it, how should it be implemented, and what is the way to do it?


use WebClient, then set the ContentType of the request header to application/x-www-form-urlencoded, and then call the UploadString () method of the WebClient instance, as follows:

string URI = "http://www.myurl.com/post.php";
string myParameters = "param1=value1&param2=value2&param3=value3";

using (WebClient wc = new WebClient())
{
    wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
    string HtmlResult = wc.UploadString(URI, myParameters);
}
For more solutions, please refer to .How do I use WebClient to send (POST) data to a specified remote request address in NET/C-sharp application development?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9be17-188c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9be17-188c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?