HttpRequestMessage Class
Represents an HTTP request message.
Namespace:
Assembly:
System.Net.Http.dll
Syntax
Constructors
| Name | Description |
|---|---|
| HttpRequestMessage() | Initializes a new instance of the HttpRequestMessage class. |
| HttpRequestMessage(HttpMethod, String) | Initializes a new instance of the HttpRequestMessage class with a specific HTTP method and URI. |
| HttpRequestMessage(HttpMethod, Uri) | Initializes a new instance of the HttpRequestMessage class with a specific HTTP method and URI. |
Properties
| Name | Description |
|---|---|
| Content | Gets or sets the HTTP content, if the request is not for a resource that is expected to have entity-body content. |
| Headers | Gets an HttpRequestHeaders object that contains the HTTP headers for the current request. |
| Method | Gets or sets the HTTP method used to send the request. |
| Options | Gets the collection of optional properties for the request. |
| Properties | Gets the collection of optional properties for the request. |
| RequestUri | Gets or sets the Uniform Resource Identifier (URI) of the request. |
| Version | Gets or sets the HTTP version used to send the request. |
Methods
| Name | Description |
|---|---|
| Dispose() | Releases the unmanaged resources that are used by the current instance of the HttpRequestMessage class. |
| Dispose(Boolean) | Releases the unmanaged resources used by the current instance of the HttpRequestMessage class, and optionally releases the managed resources. |
| ToString() | Returns a string that represents the current object. |
Constructors
HttpRequestMessage()
Initializes a new instance of the HttpRequestMessage class.
HttpRequestMessage(HttpMethod, String)
Initializes a new instance of the HttpRequestMessage class with a specific HTTP method and URI.
Parameters:
- method: The HTTP method to use.
- requestUri: The URI to send the request to.
HttpRequestMessage(HttpMethod, Uri)
Initializes a new instance of the HttpRequestMessage class with a specific HTTP method and URI.
Parameters:
- method: The HTTP method to use.
- requestUri: The URI to send the request to.
Properties
Content
Gets or sets the HTTP content, if the request is not for a resource that is expected to have entity-body content.
A HttpContent object that contains the HTTP body of the request. null if the request has no body.
Headers
Gets an HttpRequestHeaders object that contains the HTTP headers for the current request.
An HttpRequestHeaders object that contains the HTTP headers for the current request.
Method
Gets or sets the HTTP method used to send the request.
An HttpMethod object representing the HTTP method.
Options
Gets the collection of optional properties for the request.
A collection of optional properties for the request.
Properties
Gets the collection of optional properties for the request.
A dictionary of optional properties for the request.
RequestUri
Gets or sets the Uniform Resource Identifier (URI) of the request.
A Uri object representing the URI of the request.
Version
Gets or sets the HTTP version used to send the request.
A Version object representing the HTTP version.
Methods
Dispose()
Releases the unmanaged resources that are used by the current instance of the HttpRequestMessage class.
This method is called by the public Dispose method to release unmanaged resources.
Dispose(Boolean)
Releases the unmanaged resources used by the current instance of the HttpRequestMessage class, and optionally releases the managed resources.
Parameters:
- disposing: true to release both managed and unmanaged resources; false to release only unmanaged resources.
ToString()
Returns a string that represents the current object.
Returns a string that represents the current object.