Send a GET request to the specified URI as an asynchronous operation.
OverloadsThe operation will not block.
GetAsync(String)Send a GET request to the specified URI as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(System::String ^ requestUri);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string requestUri);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string? requestUri);
member this.GetAsync : string -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As String) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
.NET Core and .NET 5 and later only: The request failed due to timeout.
The provided request URI is not valid relative or absolute URI.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete after the whole response (including content) is read. The behavior is the same as if ResponseContentRead has been explicitly specified.
GetAsync(Uri)Send a GET request to the specified URI as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(Uri ^ requestUri);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri requestUri);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri? requestUri);
member this.GetAsync : Uri -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As Uri) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete after the whole response (including content) is read. The behavior is the same as if ResponseContentRead has been explicitly specified.
GetAsync(String, HttpCompletionOption)Send a GET request to the specified URI with an HTTP completion option as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(System::String ^ requestUri, System::Net::Http::HttpCompletionOption completionOption);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption);
member this.GetAsync : string * System.Net.Http.HttpCompletionOption -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As String, completionOption As HttpCompletionOption) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
An HTTP completion option value that indicates when the operation should be considered completed.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.
.NET Core and .NET 5 and later only: The request failed due to timeout.
The provided request URI is not valid relative or absolute URI.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete based on the completionOption
parameter after the part or all of the response (including content) is read.
Send a GET request to the specified URI with a cancellation token as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(System::String ^ requestUri, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string requestUri, System.Threading.CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string? requestUri, System.Threading.CancellationToken cancellationToken);
member this.GetAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As String, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
The provided request URI is not valid relative or absolute URI.
The cancellation token was canceled. This exception is stored into the returned task.
-or-
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete after the whole response (including content) is read. The behavior is the same as if ResponseContentRead has been explicitly specified.
GetAsync(Uri, HttpCompletionOption)Send a GET request to the specified URI with an HTTP completion option as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(Uri ^ requestUri, System::Net::Http::HttpCompletionOption completionOption);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri requestUri, System.Net.Http.HttpCompletionOption completionOption);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri? requestUri, System.Net.Http.HttpCompletionOption completionOption);
member this.GetAsync : Uri * System.Net.Http.HttpCompletionOption -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As Uri, completionOption As HttpCompletionOption) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
An HTTP completion option value that indicates when the operation should be considered completed.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete based on the completionOption
parameter after the part or all of the response (including content) is read.
Send a GET request to the specified URI with a cancellation token as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(Uri ^ requestUri, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri requestUri, System.Threading.CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri? requestUri, System.Threading.CancellationToken cancellationToken);
member this.GetAsync : Uri * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As Uri, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
TThe request failed due to an issue getting an HTTP response such as network connectivity, DNS failure or server certificate validation. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
The cancellation token was canceled. This exception is stored into the returned task.
-or-
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete after the whole response (including content) is read. The behavior is the same as if ResponseContentRead has been explicitly specified.
GetAsync(String, HttpCompletionOption, CancellationToken)Send a GET request to the specified URI with an HTTP completion option and a cancellation token as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(System::String ^ requestUri, System::Net::Http::HttpCompletionOption completionOption, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken);
member this.GetAsync : string * System.Net.Http.HttpCompletionOption * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As String, completionOption As HttpCompletionOption, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
An HTTP completion option value that indicates when the operation should be considered completed.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
The provided request URI is not valid relative or absolute URI.
The cancellation token was canceled. This exception is stored into the returned task.
-or-
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete based on the completionOption
parameter after the part or all of the response (including content) is read.
Send a GET request to the specified URI with an HTTP completion option and a cancellation token as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ GetAsync(Uri ^ requestUri, System::Net::Http::HttpCompletionOption completionOption, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> GetAsync(Uri? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken);
member this.GetAsync : Uri * System.Net.Http.HttpCompletionOption * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function GetAsync (requestUri As Uri, completionOption As HttpCompletionOption, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parameters
The URI the request is sent to.
An HTTP completion option value that indicates when the operation should be considered completed.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
ReturnsThe task object representing the asynchronous operation.
ExceptionsThe requestUri
is not an absolute URI and BaseAddress isn't set.
The request failed due to an issue getting a valid HTTP response, such as network connectivity failure, DNS failure, server certificate validation error, or invalid server response. On .NET 8 and later versions, the reason is indicated by HttpRequestError
-or-
.NET Framework only: the request timed out.
The cancellation token was canceled. This exception is stored into the returned task.
-or-
.NET Core and .NET 5 and later only: The request failed due to timeout.
RemarksThis operation doesn't block. The returned Task<TResult> object will complete based on the completionOption
parameter after the part or all of the response (including content) is read.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4