Using the WebClient Class
The WebClient class provides common methods for sending data to and receiving data from a resource identified by a URL. Underneath the covers, the WebClient class uses the WebRequest class (which is covered in more detail later in this chapter) to provide access to Internet resources. For this reason, the WebClient class is easier to use than the WebRequest class because it encapsulates the WebRequest class at a higher level, and abstracts much of the detail out.
The WebClient class has four methods for performing data transfer. They are the OpenWrite() method, which sends a stream to the resource; the UploadData() method, which sends a byte array to the resource and returns the byte array with any response; the UploadFile() ...
Get Special Edition Using® Microsoft® ASP.NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.