HttpRequestMessage HttpRequestMessage HttpRequestMessage HttpRequestMessage HttpRequestMessage Class


Represents an HTTP request message including headers.

public : sealed class HttpRequestMessage : IClosable, IStringable
struct winrt::Windows::Web::Http::HttpRequestMessage : IClosable, IStringable
public sealed class HttpRequestMessage : IDisposable, IStringable
Public NotInheritable Class HttpRequestMessage Implements IDisposable, IStringable
var httpRequestMessage = new httpRequestMessage();

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The HttpRequestMessage class contains headers, the HTTP verb, and potentially data. This class is commonly used by developers who need additional control over HTTP requests. Common examples include the following:

  • To examine the underlying SSL/TLS transport information.
  • To use a less-common HTTP method.
  • To explicitly set request properties on the HttpRequestMessage.

In these cases, an app uses one of the HttpRequestMessage constructors to create an HttpRequestMessage instance. The app sets various properties on the HttpRequestMessage as needed. Then the HttpRequestMessage is passed as a parameter to one of the HttpClient.SendRequestAsync methods.

A number of convenience methods on the HttpClient class automatically create an HttpRequestMessage object for the app. These methods include the following:

Any filters that you add to the filter pipeline will be passed the HttpRequestMessage object whether it was explicitly specified by the app or was automatically constructed for you.


HttpRequestMessage() HttpRequestMessage() HttpRequestMessage() HttpRequestMessage() HttpRequestMessage()

Initializes a new instance of the HttpRequestMessage class.

HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri)

Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.


Content Content Content Content Content

Gets or sets the HTTP content to send to the server on the HttpRequestMessage object.

Headers Headers Headers Headers Headers

Gets the collection of the HTTP request headers associated with the HttpRequestMessage.

Method Method Method Method Method

Gets or sets the HTTP method to be performed on the request URI.

Properties Properties Properties Properties Properties

Gets a set of properties on the HttpRequestMessage instance that are for use by the developer.

RequestUri RequestUri RequestUri RequestUri RequestUri

Gets or sets the Uri used for the HttpRequestMessage object.

TransportInformation TransportInformation TransportInformation TransportInformation TransportInformation

Get information about the underlying transport socket used by an HTTP connection.


Close() Close() Close() Close() Close()

Closes the HttpRequestMessage instance and releases allocated resources.

Dispose() Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ToString() ToString() ToString() ToString() ToString()

Returns a string that represents the current HttpRequestMessage object.

See also