Table of Contents

Class HttpRequestMessage

Namespace
System.Net.Http
Assembly
System.Net.Http.dll

Represents a HTTP request message.

public class HttpRequestMessage : IDisposable
Inheritance
HttpRequestMessage
Implements
Inherited Members
Extension Methods

Constructors

HttpRequestMessage()

Initializes a new instance of the HttpRequestMessage class.

public HttpRequestMessage()

HttpRequestMessage(HttpMethod, string)

Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.

public HttpRequestMessage(HttpMethod method, string requestUri)

Parameters

method HttpMethod

The HTTP method.

requestUri string

A string that represents the request Uri.

Properties

Content

Gets or sets the contents of the HTTP message.

public HttpContent Content { get; set; }

Property Value

HttpContent

Headers

Gets the collection of HTTP request headers.

public HttpRequestHeaders Headers { get; }

Property Value

HttpRequestHeaders

The collection of HTTP request headers.

Method

Gets or sets the HTTP method used by the HTTP request message.

public HttpMethod Method { get; set; }

Property Value

HttpMethod

The HTTP method used by the request message. The default is the GET method.

RequestUri

Gets or sets the Uri used for the HTTP request.

public Uri RequestUri { get; set; }

Property Value

Uri

The Uri used for the HTTP request.

Remarks

If the request Uri is a relative Uri, it will be combined with the BaseAddress.

Version

Gets or sets the HTTP message version.

public Version Version { get; set; }

Property Value

Version

The HTTP message version. The default value is 1.1.

Methods

Dispose()

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

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool