HttpClient.TryGetAsync HttpClient.TryGetAsync HttpClient.TryGetAsync HttpClient.TryGetAsync HttpClient.TryGetAsync Method

Definition

Overloads

TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri)

Sends a GET request to the specified Uri as an asynchronous operation.

TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption)

Sends a GET request to the specified Uri as an asynchronous operation.

TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri) TryGetAsync(Uri)

Sends a GET request to the specified Uri as an asynchronous operation.

public : IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri)
IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri) const;
public IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri)
Public Function TryGetAsync(uri As Uri) As IAsyncOperationWithProgress(Of HttpRequestResultHttpProgress)
Windows.Web.Http.HttpClient.tryGetAsync(uri).done( /* Your success and error handlers */ );

Parameters

uri
Uri Uri Uri

The Uri the request is sent to.

Returns

Additional features and requirements

Device family
Windows 10, version 1903 (introduced v10.0.18362.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v8)

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(HttpRequestResult,HttpProgress) object will complete after the whole response (including content) is read.

See also

TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption) TryGetAsync(Uri, HttpCompletionOption)

Sends a GET request to the specified Uri as an asynchronous operation.

public : IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri, HttpCompletionOption completionOption)
IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri, HttpCompletionOption completionOption) const;
public IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TryGetAsync(Uri uri, HttpCompletionOption completionOption)
Public Function TryGetAsync(uri As Uri, completionOption As HttpCompletionOption) As IAsyncOperationWithProgress(Of HttpRequestResultHttpProgress)
Windows.Web.Http.HttpClient.tryGetAsync(uri, completionOption).done( /* Your success and error handlers */ );

Parameters

uri
Uri Uri Uri

The Uri the request is sent to.

completionOption
HttpCompletionOption HttpCompletionOption HttpCompletionOption

An HTTP completion option value that indicates when the operation should be considered completed.

Returns

Additional features and requirements

Device family
Windows 10, version 1903 (introduced v10.0.18362.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v8)

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(HttpRequestResult,HttpProgress) object will complete based on the completionOption parameter after part or all of the response (including content) is read.

See also