Provides a base class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
See Also: HttpClient
The HttpClient class instance acts as a session to send HTTP requests. An HttpClient instance is a collection of settings applied to all requests executed by that instance. In addition, every HttpClient instance uses its own connection pool, isolating its requests from requests executed by other HttpClient instances.
The HttpClient also acts as a base class for more specific HTTP clients. An example would be a FacebookHttpClient providing additional methods specific to a Facebook web service (a GetFriends method, for instance).
By default, HttpWebRequest will be used to send requests to the server. This behavior can be modified by specifying a different channel in one of the constructor overloads taking a HttpMessageHandler instance as parameter. If features like authentication or caching are required, WebRequestHandler can be used to configure settings and the instance can be passed to the constructor. The returned handler can be passed to one of the constructor overloads taking a HttpMessageHandler parameter.
If an app using HttpClient and related classes in the System.Net.Http namespace intends to download large amounts of data (50 megabytes or more), then the app should stream those downloads and not use the default buffering. If the default buffering is used the client memory usage will get very large, potentially resulting in substantially reduced performance.
The following methods are thread safe:[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]
Assembly: System.Net.Http (in System.Net.Http.dll)
Assembly Versions: 126.96.36.199
The members of System.Net.Http.HttpClient are listed below.
See Also: HttpMessageInvoker
Gets or sets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.
Gets the headers which should be sent with each request.
Gets or sets the maximum number of bytes to buffer when reading the response content.
Gets or sets the number of milliseconds to wait before the request times out.