HttpResponseMessage Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an HTTP response message including headers, the status code, and data.
public ref class HttpResponseMessage sealed : IClosable, IStringable
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpResponseMessageFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpResponseMessage final : IClosable, IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpResponseMessageFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class HttpResponseMessage final : IClosable, IStringable
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpResponseMessageFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpResponseMessage : System.IDisposable, IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpResponseMessageFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpResponseMessage : System.IDisposable, IStringable
function HttpResponseMessage(statusCode)
Public NotInheritable Class HttpResponseMessage
Implements IDisposable, IStringable
- Inheritance
- Attributes
- Implements
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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.
Constructors
HttpResponseMessage() |
Initializes a new instance of the HttpResponseMessage class. |
HttpResponseMessage(HttpStatusCode) |
Initializes a new instance of the HttpResponseMessage class with a specific HttpStatusCode. |
Properties
Content |
Gets or sets the content of the HTTP response message on the HttpResponseMessage object. |
Headers |
Gets the collection of HTTP response headers associated with the HttpResponseMessage that were sent by the server. |
IsSuccessStatusCode |
Gets a value that indicates whether the HTTP response was successful. |
ReasonPhrase |
Gets or sets the reason phrase which typically is sent by servers together with the status code. |
RequestMessage |
Gets or sets the request message that led to this response message. |
Source |
Gets the source of the data received in the HttpResponseMessage. |
StatusCode |
Gets or sets the status code of the HTTP response. |
Version |
Gets or sets the HTTP protocol version used on the HttpResponseMessage object. |
Methods
Close() |
Closes the HttpResponseMessage instance and releases allocated resources. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
EnsureSuccessStatusCode() |
Throws an exception if the HttpResponseMessage.IsSuccessStatusCode property for the HTTP response object is |
ToString() |
Returns a string that represents the current HttpResponseMessage object. |