Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 2 KB

httpclient_trypostasync_1613087419.md

File metadata and controls

37 lines (25 loc) · 2 KB
-api-id -api-type ms.custom
M:Windows.Web.Http.HttpClient.TryPostAsync(Windows.Foundation.Uri,Windows.Web.Http.IHttpContent)
winrt method
19H1

Windows.Web.Http.HttpClient.TryPostAsync

-description

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

-parameters

-param uri

The Uri the request is sent to.

-param content

The HTTP request content to send to the server.

-returns

The object representing the asynchronous operation.

-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.

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

-see-also

HttpRequestResult, IHttpContent, HttpProgress, HttpResponseMessage, HttpClient

-examples