Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpMessageHandler Class

.NET Framework 4.5

A base type for HTTP message handlers.

Namespace:  System.Net.Http
Assembly:  System.Net.Http (in System.Net.Http.dll)

public abstract class HttpMessageHandler : IDisposable

The HttpMessageHandler type exposes the following members.

  NameDescription
Protected methodSupported in .NET for Windows Store appsHttpMessageHandlerInitializes a new instance of the HttpMessageHandler class.
Top

  NameDescription
Public methodSupported in .NET for Windows Store appsDispose()Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageHandler.
Protected methodSupported in .NET for Windows Store appsDispose(Boolean)Releases the unmanaged resources used by the HttpMessageHandler and optionally disposes of the managed resources.
Public methodSupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported in .NET for Windows Store appsFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported in .NET for Windows Store appsMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodSupported in .NET for Windows Store appsSendAsyncSend an HTTP request as an asynchronous operation.
Public methodSupported in .NET for Windows Store appsToStringReturns a string that represents the current object. (Inherited from Object.)
Top

There are various HTTP message handles that can be used. These include the following.

  1. DelegatingHandler - A class used to plug a handler into a handler chain.

  2. HttpMessageHandler - A simple to class to derive from that supports the most common requirements for most applications.

  3. HttpClientHandler - A class that operates at the bottom of the handler chain that actually handles the HTTP transport operations.

  4. 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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Windows Phone 8.1, Windows 8.1, Windows Server 2012 R2, 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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft