The C # form submission method mainly includes two types of WebClient and HttpWebRequest. Here we first introduce one
WebClient, Transfer doors: http://msdn.microsoft.com/zh-cn/library/system.net.webclient (v = VS.80). aspx
String postString = "arg1 = a & arg2 = B"; // This is the passed parameter. You can use a tool to capture packets for analysis or analyze it yourself, in the form, each name must be added to byte [] postData = Encoding. UTF8.GetBytes (postString); // encoding, especially for Chinese characters. You must first check the encoding method of the captured webpage: string url = "http: // localhost/register. php "; // address: WebClient webClient = new WebClient (); webClient. headers. add ("Content-Type", "application/x-www-form-urlencoded"); // header required for POST, if you change the GET method, you can remove this sentence byte [] responseData = webClient. uploadData (url, "POST", postData); // returns the response stream string srcString = Encoding. UTF8.GetString (responseData); // decoded
You should pay attention to your website. If your webpage needs to be registered and logged on, please add a verification code. Similar principles are used for automatic registration machines and Forum Water Filling Machines.
However, this is what I relied on when I selected the course. This is also the advantage of the computer system !!!