We know that webrequest (httpwebrequest, ftpwebrequest) and webresponse (httpwebresponse, ftpwebresponse) can be used to download and upload files and capture webpages, but WebClient is easier to use. Download the web page using (system. net. webClient client = new system. net. webClient () {client. downloadfile ("http://www.cftea.com/", "C: \ foo.txt");} in this way, the http://www.cftea.com/home page is saved to the C disk. Use downloaddata or openread to capture the web page using (system. net. webClient client = new system. net. webClient () {byte [] bytes = client. downloaddata ("http://www.cftea.com/"); string STR = (system. text. encoding. getencoding ("gb2312 "). getstring (bytes);} We assigned the crawled webpage to the variable STR, which is used by us. You can also use the openread method to obtain data streams. Using (system. net. webClient client = new system. net. webClient () {using (system. io. stream stream = client. openread ("http://www.cftea.com/") {using (system. io. streamreader reader = new system. io. streamreader (stream, system. text. encoding. getencoding ("gb2312") {string STR = reader. readtoend (); reader. close ();} stream. close () ;}use uploadfile to upload files. Compared with downloaddata and openread, WebClient also has uploaddata, Openwrite method, but the most common method is to upload files, that is, using the uploadfile method. Using (system. net. webClient client = new system. net. webClient () {client. credentials = new system. net. networkcredential ("username", "password"); client. uploadfile ("ftp://www.cftea.com/foo.txt", "C: \ foo.txt");} pay attention to the first parameter of uploadfile, add the file name after upload, that is, it cannot be: ftp://www.cftea.com /.