HttpClient.PutAsync(Uri, IHttpContent) Method

Definition

Send a PUT request to the specified Uri as an asynchronous operation. For programming guidance for the HttpClient class, and code examples, see the HttpClient conceptual topic.

public:
 virtual IAsyncOperationWithProgress<HttpResponseMessage ^, HttpProgress> ^ PutAsync(Uri ^ uri, IHttpContent ^ content) = PutAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<HttpResponseMessage, HttpProgress> PutAsync(Uri const& uri, IHttpContent const& content);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<HttpResponseMessage,HttpProgress> PutAsync(System.Uri uri, IHttpContent content);
function putAsync(uri, content)
Public Function PutAsync (uri As Uri, content As IHttpContent) As IAsyncOperationWithProgress(Of HttpResponseMessage, HttpProgress)

Parameters

uri
Uri Uri

The Uri the request is sent to.

content
IHttpContent

The HTTP request content to send to the server.

Returns

The object representing the asynchronous operation.

Attributes

Remarks

This operation will not block. The returned IAsyncOperationWithProgress (of HttpResponseMessage and HttpProgress) completes after the whole response (including content) is read.

The PutAsync and PostAsync methods only allow setting a limited number of HTTP content headers. In contrast, the SendRequestAsync method allows setting headers on the request message as well as on the HTTP content to be sent.

Below are the exceptions that this function throws.

E_INVALIDARG

The uri parameter was a null reference (Nothing in Visual Basic).

Applies to

See also