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.

HttpRequestMessage class

Applies to Windows and Windows Phone

Represents an HTTP request message including headers.

Syntax


var httpRequestMessage = new Windows.Web.Http.HttpRequestMessage(httpMethod, uri);
var httpRequestMessage = new Windows.Web.Http.HttpRequestMessage();

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06030000)]

Members

The HttpRequestMessage class has these types of members:

Constructors

The HttpRequestMessage class has these constructors.

ConstructorDescription
HttpRequestMessage() Initializes a new instance of the HttpRequestMessage class.
HttpRequestMessage(HttpMethod, Uri) Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.

 

Methods

The HttpRequestMessage class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Close [C++, JavaScript]Closes the HttpRequestMessage instance and releases allocated resources.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
ToString Returns a string that represents the current HttpRequestMessage object.

 

Properties

The HttpRequestMessage class has these properties.

PropertyAccess typeDescription

Content

Read/writeGets or sets the HTTP content to send to the server on the HttpRequestMessage object.

Headers

Read-onlyGets the collection of the HTTP request headers associated with the HttpRequestMessage.

Method

Read/writeGets or sets the HTTP method to be performed on the request URI.

Properties

Read-onlyGets a set of properties on the HttpRequestMessage instance that are for use by the developer.

RequestUri

Read/writeGets or sets the Uri used for the HttpRequestMessage object.

TransportInformation

Read-onlyGet information about the underlying transport socket used by an HTTP connection.

 

Remarks

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.

Requirements

Minimum supported client

Windows 8.1 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.winmd

See also

HttpClient
Object
IClosable
IStringable

 

 

Show:
© 2014 Microsoft