IHttpContent IHttpContent IHttpContent IHttpContent IHttpContent Interface


Provides a base interface for an HTTP entity body and content headers.

public : interface IHttpContent : IClosable
struct winrt::Windows::Web::Http::IHttpContent : IClosable
public interface IHttpContent : IDisposable
Public Interface IHttpContent Implements IDisposable
// You can't instantiate an interface directly in JavaScript. You can use objects that implement the interface, however.

Windows 10 requirements

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


The contents of an HTTP message corresponds to the entity body and headers associated with the content defined in RFC 2616. Several classes and an interface in the Windows.Web.Http namespace can be used for HTTP content, including:

  • IHttpContent - A base interface for developers to create their own content objects. It represents an HTTP entity body and content headers. This interface has methods that get and set the actual content data. It also provides properties that get and set content related headers.
  • HttpBufferContent - HTTP content that uses a buffer.
  • HttpFormUrlEncodedContent - HTTP content that uses name/value tuples encoded with the 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 that uses a stream. This content type is used by the HTTP methods to receive data and HTTP methods to upload data.
  • HttpStringContent - HTTP content that uses a string.


Headers Headers Headers Headers Headers

Get a collection of content headers set on the IHttpContent.


BufferAllAsync() BufferAllAsync() BufferAllAsync() BufferAllAsync() BufferAllAsync()

Serialize the HTTP content into memory as an asynchronous operation.

Close Close Close Close Close

Releases system resources that are exposed by a Windows Runtime object.

.NET This interface appears as System.IDisposable.

C++/CX This interface appears as Platform::IDisposable.

(Inherited from IClosable)
ReadAsBufferAsync() ReadAsBufferAsync() ReadAsBufferAsync() ReadAsBufferAsync() ReadAsBufferAsync()

Serialize the HTTP content to a buffer as an asynchronous operation.

ReadAsInputStreamAsync() ReadAsInputStreamAsync() ReadAsInputStreamAsync() ReadAsInputStreamAsync() ReadAsInputStreamAsync()

Serialize the HTTP content and return an input stream that represents the content as an asynchronous operation.

ReadAsStringAsync() ReadAsStringAsync() ReadAsStringAsync() ReadAsStringAsync() ReadAsStringAsync()

Serialize the HTTP content to a String as an asynchronous operation.

TryComputeLength(UInt64) TryComputeLength(UInt64) TryComputeLength(UInt64) TryComputeLength(UInt64) TryComputeLength(UInt64)

Determines whether the HTTP content has a valid length in bytes.

WriteToStreamAsync(IOutputStream) WriteToStreamAsync(IOutputStream) WriteToStreamAsync(IOutputStream) WriteToStreamAsync(IOutputStream) WriteToStreamAsync(IOutputStream)

Write the HTTP content to an output stream as an asynchronous operation.

See also