System.Net.WebClient.UploadDataAsync Method

Uploads a data buffer to a resource identified by a URI, using the POST method. This method does not block the calling thread.

Syntax

public void UploadDataAsync (Uri address, byte[] data)

Parameters

address
The URI of the resource to receive the data.
data
The data buffer to send to the resource.

Remarks

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. To receive notification when the data upload completes, add an event handler to the WebClient.UploadDataCompleted event.

This method does not block the calling thread while the data is being sent. To send data and block while waiting for the server's response, use one of the erload:System.Net.WebClient.UploadData methods.

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

If the WebClient.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 WebClient.BaseAddress to form the absolute URI of the requested data. If the WebClient.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.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0