HttpMessageHandler Class
A base type for HTTP message handlers.
System.Net.Http.HttpMessageHandler
System.Net.Http.DelegatingHandler
System.Net.Http.HttpClientHandler
Namespace: System.Net.Http
Assembly: System.Net.Http (in System.Net.Http.dll)
The HttpMessageHandler type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Dispose() | Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageHandler. |
![]() ![]() | Dispose(Boolean) | Releases the unmanaged resources used by the HttpMessageHandler and optionally disposes of the managed resources. |
![]() ![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | SendAsync | Send an HTTP request as an asynchronous operation. |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
There are various HTTP message handles that can be used. These include the following.
DelegatingHandler - A class used to plug a handler into a handler chain.
HttpMessageHandler - A simple to class to derive from that supports the most common requirements for most applications.
HttpClientHandler - A class that operates at the bottom of the handler chain that actually handles the HTTP transport operations.
WebRequestHandler - A specialty class that operates at the bottom of the handler chain class that handles HTTP transport operations with options that are specific to the System.Net.HttpWebRequest object.
If developers derive classes from HttpMessageHandler and override the SendAsync method, they must make sure that SendAsync can get called concurrently by different threads.
This is necessary since methods on HttpClient can be called concurrently and need a guarantee of thread safety. So if a handler is assigned to an HttpClient instance, the SendAsync method of the handler may get called concurrently by the HttpClient instance and needs to be thread safe.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

