Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
WebRequest and WebResponse are the
common base classes for managing both HTTP and FTP client-side activity,
as well as the “file:” protocol. They encapsulate the “request/response”
model that these protocols all share: the client makes a request, and then
awaits a response from a server.
WebClient is a convenient
façade class that does the work of calling WebRequest and WebResponse, saving you some coding. WebClient gives you a choice of dealing in
strings, byte arrays, files, or streams; WebRequest and WebResponse support just streams. Unfortunately,
you cannot rely entirely on WebClient
because it doesn’t support some features (such as cookies).
HttpClient is another class that
builds on WebRequest and WebResponse (or more specifically, HttpWebRequest and HttpWebResponse) and is new to Framework 4.5.
Whereas WebClient acts mostly as a thin
layer over the request/response classes, HttpClient adds functionality to help you work
with HTTP-based web APIs, REST-based services, and custom authentication
schemes.