Windows.Web.Http.HttpClient.GetAsync
December 16, 2020 ยท View on GitHub
-description
Send a GET request to the specified Uri with an HTTP completion option 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 completionOption
An HTTP completion option value that indicates when the operation should be considered completed.
-returns
The object representing the asynchronous operation.
-remarks
This operation will not block. The returned IAsyncOperationWithProgress (of HttpResponseMessage and HttpProgress) completes based on the completionOption parameter after part or all of the response (including content) is read.
Below are the exceptions that this content throws.
COMException
Thrown when a feature-specific HRESULT is returned from a method call.
This is the most common exception that is thrown by networking methods. An app should use the HRESULT from the exception to determine the cause of the error.
AccessDeniedException
Thrown when access is denied to a resource or feature. This exception occurs when an app doesn't have the required network capabilities set in the app manifest for the network operation requested.
InvalidArgumentException
Thrown when one of the arguments that are provided to a method is not valid.
If user-supplied input caused this exception, an app could inform the user and request new input.
ObjectDisposedException
Thrown when an operation is performed on a disposed object.
OutOfMemoryException
Thrown when insufficient memory is available to complete the operation.
-examples
-see-also
Connecting to an HTTP server using Windows.Web.Http, Handling exceptions in network apps, GetAsync(Uri), HttpCompletionOption, IAsyncOperationWithProgress, HttpResponseMessage, HttpProgress, System.Uri, Windows.Foundation.Uri, Windows.Web.Http, HttpClient