HttpResponseMessage HttpResponseMessage HttpResponseMessage HttpResponseMessage HttpResponseMessage Class


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

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

Windows 10 requirements

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


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.


HttpResponseMessage() HttpResponseMessage() HttpResponseMessage() HttpResponseMessage() HttpResponseMessage()

Initializes a new instance of the HttpResponseMessage class.

HttpResponseMessage(HttpStatusCode) HttpResponseMessage(HttpStatusCode) HttpResponseMessage(HttpStatusCode) HttpResponseMessage(HttpStatusCode) HttpResponseMessage(HttpStatusCode)

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


Content Content Content Content Content

Gets or sets the content of the HTTP response message on the HttpResponseMessage object.

Headers Headers Headers Headers Headers

Gets the collection of HTTP response headers associated with the HttpResponseMessage that were sent by the server.

IsSuccessStatusCode IsSuccessStatusCode IsSuccessStatusCode IsSuccessStatusCode IsSuccessStatusCode

Gets a value that indicates whether the HTTP response was successful.

ReasonPhrase ReasonPhrase ReasonPhrase ReasonPhrase ReasonPhrase

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

RequestMessage RequestMessage RequestMessage RequestMessage RequestMessage

Gets or sets the request message that led to this response message.

Source Source Source Source Source

Gets the source of the data received in the HttpResponseMessage.

StatusCode StatusCode StatusCode StatusCode StatusCode

Gets or sets the status code of the HTTP response.

Version Version Version Version Version

Gets or sets the HTTP protocol version used on the HttpResponseMessage object.


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

Closes the HttpResponseMessage instance and releases allocated resources.

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

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

EnsureSuccessStatusCode() EnsureSuccessStatusCode() EnsureSuccessStatusCode() EnsureSuccessStatusCode() EnsureSuccessStatusCode()

Throws an exception if the IsSuccessStatusCode property for the HTTP response is false.

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

Returns a string that represents the current HttpResponseMessage object.

See also