HttpRequestMessage.Content Property
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.
Gets or sets the HTTP content to send to the server on the HttpRequestMessage object.
public:
property IHttpContent ^ Content { IHttpContent ^ get(); void set(IHttpContent ^ value); };
IHttpContent Content();
void Content(IHttpContent value);
public IHttpContent Content { get; set; }
var iHttpContent = httpRequestMessage.content;
httpRequestMessage.content = iHttpContent;
Public Property Content As IHttpContent
Property Value
The HTTP content to send to the server on the HttpRequestMessage object.
Remarks
The content of an HTTP request message corresponds to the entity body defined in RFC 2616.
A number of classes and an interface can be used for HTTP content. These include the following.
- IHttpContent - a base interface representing an HTTP entity body and content headers.
- HttpBufferContent - HTTP content based on a stream.
- HttpFormUrlEncodedContent - HTTP content based on name/value data encoded using application/x-www-form-urlencoded MIME type.
- HttpMultipartContent - HTTP content that uses multipart/* MIME type.
- HttpMultipartFormDataContent - HTTP content that uses the encoded multipart/form-data MIME type.
- HttpStreamContent - HTTP content based on a stream.
- HttpStringContent - HTTP content based on a string.
A number of HttpClient methods don't need to set the Content property on the HttpRequestMessage. These include the following:
- The HttpClient.GetAsync methods.
- HttpClient.GetBufferAsync.
- HttpClient.GetInputStreamAsync.
- HttpClient.GetStringAsync.