WebClient.UploadDataTaskAsync WebClient.UploadDataTaskAsync WebClient.UploadDataTaskAsync WebClient.UploadDataTaskAsync Method

Definition

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object. These methods do not block the calling thread.

Overloads

UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

public:
 System::Threading::Tasks::Task<cli::array <System::Byte> ^> ^ UploadDataTaskAsync(System::String ^ address, cli::array <System::Byte> ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task<byte[]> UploadDataTaskAsync (string address, byte[] data);
member this.UploadDataTaskAsync : string * byte[] -> System.Threading.Tasks.Task<byte[]>
Public Function UploadDataTaskAsync (address As String, data As Byte()) As Task(Of Byte())

Parameters

address
String String String String

The URI of the resource to receive the data.

data
Byte[]

The data buffer to send to the resource.

Returns

Task<Byte[]>

The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the body of the response received from the resource when the data buffer was uploaded.

Exceptions

The URI formed by combining BaseAddress and address is invalid.

-or-

An error occurred while opening the stream.

-or-

There was no response from the server hosting the resource.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the a data buffer has been uploaded to the resource.

This method sends a data buffer to a resource. The data buffer is sent asynchronously using thread resources that are automatically allocated from the thread pool. The data is not encoded.

Asynchronous operations that have not completed can be canceled using the CancelAsync method.

If the BaseAddress property is not an empty string (""), and address does not contain an absolute URI, address must be a relative URI that is combined with BaseAddress to form the absolute URI of the requested data. If the QueryString property is not an empty string, it is appended to address.

This method uses the STOR command to upload an FTP resource. For an HTTP resource, the POST method is used.

Note

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

public:
 System::Threading::Tasks::Task<cli::array <System::Byte> ^> ^ UploadDataTaskAsync(Uri ^ address, cli::array <System::Byte> ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task<byte[]> UploadDataTaskAsync (Uri address, byte[] data);
member this.UploadDataTaskAsync : Uri * byte[] -> System.Threading.Tasks.Task<byte[]>
Public Function UploadDataTaskAsync (address As Uri, data As Byte()) As Task(Of Byte())

Parameters

address
Uri Uri Uri Uri

The URI of the resource to receive the data.

data
Byte[]

The data buffer to send to the resource.

Returns

Task<Byte[]>

The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the body of the response received from the resource when the data buffer was uploaded.

Exceptions

The URI formed by combining BaseAddress and address is invalid.

-or-

An error occurred while opening the stream.

-or-

There was no response from the server hosting the resource.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the a data buffer has been uploaded to the resource.

This method sends a data buffer to a resource. The data buffer is sent asynchronously using thread resources that are automatically allocated from the thread pool. The data is not encoded.

Asynchronous operations that have not completed can be canceled using the CancelAsync method.

If the BaseAddress property is not an empty string (""), and address does not contain an absolute URI, address must be a relative URI that is combined with BaseAddress to form the absolute URI of the requested data. If the QueryString property is not an empty string, it is appended to address.

This method uses the STOR command to upload an FTP resource. For an HTTP resource, the POST method is used.

Note

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

public:
 System::Threading::Tasks::Task<cli::array <System::Byte> ^> ^ UploadDataTaskAsync(System::String ^ address, System::String ^ method, cli::array <System::Byte> ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task<byte[]> UploadDataTaskAsync (string address, string method, byte[] data);
member this.UploadDataTaskAsync : string * string * byte[] -> System.Threading.Tasks.Task<byte[]>
Public Function UploadDataTaskAsync (address As String, method As String, data As Byte()) As Task(Of Byte())

Parameters

address
String String String String

The URI of the resource to receive the data.

method
String String String String

The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.

data
Byte[]

The data buffer to send to the resource.

Returns

Task<Byte[]>

The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the body of the response received from the resource when the data buffer was uploaded.

Exceptions

The URI formed by combining BaseAddress and address is invalid.

-or-

An error occurred while opening the stream.

-or-

There was no response from the server hosting the resource.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the a data buffer has been uploaded to the resource.

This method sends a data buffer to a resource. The data buffer is sent asynchronously using thread resources that are automatically allocated from the thread pool. The data is not encoded.

Asynchronous operations that have not completed can be canceled using the CancelAsync method.

If the BaseAddress property is not an empty string (""), and address does not contain an absolute URI, address must be a relative URI that is combined with BaseAddress to form the absolute URI of the requested data. If the QueryString property is not an empty string, it is appended to address.

Note

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[])

Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.

public:
 System::Threading::Tasks::Task<cli::array <System::Byte> ^> ^ UploadDataTaskAsync(Uri ^ address, System::String ^ method, cli::array <System::Byte> ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.Tasks.Task<byte[]> UploadDataTaskAsync (Uri address, string method, byte[] data);
member this.UploadDataTaskAsync : Uri * string * byte[] -> System.Threading.Tasks.Task<byte[]>
Public Function UploadDataTaskAsync (address As Uri, method As String, data As Byte()) As Task(Of Byte())

Parameters

address
Uri Uri Uri Uri

The URI of the resource to receive the data.

method
String String String String

The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.

data
Byte[]

The data buffer to send to the resource.

Returns

Task<Byte[]>

The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the body of the response received from the resource when the data buffer was uploaded.

Exceptions

The URI formed by combining BaseAddress and address is invalid.

-or-

An error occurred while opening the stream.

-or-

There was no response from the server hosting the resource.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the a data buffer has been uploaded to the resource.

This method sends a data buffer to a resource. The data buffer is sent asynchronously using thread resources that are automatically allocated from the thread pool. The data is not encoded.

Asynchronous operations that have not completed can be canceled using the CancelAsync method.

If the BaseAddress property is not an empty string (""), and address does not contain an absolute URI, address must be a relative URI that is combined with BaseAddress to form the absolute URI of the requested data. If the QueryString property is not an empty string, it is appended to address.

Note

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

Applies to