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.

HttpResponseMessage class

Applies to Windows and Windows Phone

Represents an HTTP response message including headers, the status code, and data.

Syntax


public sealed class HttpResponseMessage : IDisposable,
    IStringable

Attributes

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

Members

The HttpResponseMessage class has these types of members:

Constructors

The HttpResponseMessage class has these constructors.

ConstructorDescription
HttpResponseMessage() Initializes a new instance of the HttpResponseMessage class.
HttpResponseMessage(HttpStatusCode) Initializes a new instance of the HttpResponseMessage class with a specific HttpStatusCode.

 

Methods

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

MethodDescription
Close [C++, JavaScript]Closes the HttpResponseMessage instance and releases allocated resources.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
EnsureSuccessStatusCode Throws an exception if the IsSuccessStatusCode property for the HTTP response is false.
ToString Returns a string that represents the current HttpResponseMessage object.

 

Properties

The HttpResponseMessage class has these properties.

PropertyAccess typeDescription

Content

Read/writeGets or sets the content of the HTTP response message on the HttpResponseMessage object.

Headers

Read-onlyGets the collection of HTTP response headers associated with the HttpResponseMessage that were sent by the server.

IsSuccessStatusCode

Read-onlyGets a value that indicates whether the HTTP response was successful.

ReasonPhrase

Read/writeGets or sets the reason phrase which typically is sent by servers together with the status code.

RequestMessage

Read/writeGets or sets the request message which led to this response message.

Source

Read/writeGets the source of the data received in the HttpResponseMessage.

StatusCode

Read/writeGets or sets the status code of the HTTP response.

Version

Read/writeGets or sets the HTTP protocol version used on the HttpResponseMessage object.

 

Remarks

A common way to get an HttpResponseMessage is the from the return value for one of the DeleteAsync, GetAsync, PostAsync , PutAsync, or SendRequestAsync methods on the HttpClient object.

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