HttpClient.TrySendRequestAsync HttpClient.TrySendRequestAsync HttpClient.TrySendRequestAsync HttpClient.TrySendRequestAsync HttpClient.TrySendRequestAsync Method

Definition

Overloads

TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage)

Sends an HTTP request to the specified Uri as an asynchronous operation.

TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption)

Sends an HTTP request with a completion option to the specified Uri as an asynchronous operation.

TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage) TrySendRequestAsync(HttpRequestMessage)

Sends an HTTP request to the specified Uri as an asynchronous operation.

public : IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TrySendRequestAsync(HttpRequestMessage request)
IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TrySendRequestAsync(HttpRequestMessage request) const;
public IAsyncOperationWithProgress<HttpRequestResult, HttpProgress> TrySendRequestAsync(HttpRequestMessage request)
Public Function TrySendRequestAsync(request As HttpRequestMessage) As IAsyncOperationWithProgress(Of HttpRequestResultHttpProgress)
Windows.Web.Http.HttpClient.trySendRequestAsync(request).done( /* Your success and error handlers */ );

Parameters

request
HttpRequestMessage HttpRequestMessage HttpRequestMessage

The HTTP request message to send.

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

TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption) TrySendRequestAsync(HttpRequestMessage, HttpCompletionOption)

Sends an HTTP request with a completion option to the specified Uri as an asynchronous operation.

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

Parameters

request
HttpRequestMessage HttpRequestMessage HttpRequestMessage

The HTTP request message to send.

completionOption
HttpCompletionOption HttpCompletionOption HttpCompletionOption

A value that indicates whether the HttpClient operation is considered completed when all of the response is read, or when just the headers are read.

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