HttpClient.TryPutAsync(Uri, IHttpContent) Method

Definition

Sends 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<HttpRequestResult ^, HttpProgress> ^ TryPutAsync(Uri ^ uri, IHttpContent ^ content) = TryPutAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryPutAsync(Uri const& uri, IHttpContent const& content);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<HttpRequestResult,HttpProgress> TryPutAsync(System.Uri uri, IHttpContent content);
function tryPutAsync(uri, content)
Public Function TryPutAsync (uri As Uri, content As IHttpContent) As IAsyncOperationWithProgress(Of HttpRequestResult, 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

Windows requirements

Device family
Windows 10, version 1903 (introduced in 10.0.18362.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v8.0)

Remarks

This operation will not throw an exception on network errors. Instead you should examine the HttpRequestResult to learn about the original HTTP request, the resulting HTTP response (if any) and error (if any). This operation will throw when the operation is canceled.

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

Applies to

See also