Mono Class Library: System.Net.WebClient Overview | Members

System.Net.WebClient.UploadData Method

Uploads the specified data to the resource identified by the specified URI. [Edit]

public byte[] UploadData (string address, byte[] data)

Parameters

address
A string that specifies the URI of the resource to receive the data. [Edit]
data
A byte array containing data to send to the resource. [Edit]

Returns

A byte array containing the body of the response, if any, from the server hosting the resource. [Edit]

Exceptions

TypeReason
System.Net.WebException

The absolute URI is not valid.

-or-

data is null.

-or-

An error occurred while opening the stream or uploading the data.

-or-

There was no response from the server hosting the resource.

[Edit]

Remarks

This method is equivalent to WebClient.UploadData(string, Byte[]) (address, "POST", data).

If the WebClient.BaseAddress property of the current instance is not string.Empty, address is combined with WebClient.BaseAddress to form the absolute URI of the requested data. If the WebClient.BaseAddress property of the current instance is string.Empty, address is required to be the absolute URI of the requested data. If the WebClient.QueryString property of the current instance is not string.Empty, it is appended to address.

Note:

This method sends a data buffer to a resource. The underlying request is made using the POST method.

This method does not encode the contents of data before uploading it to the resource.

[Edit]

Requirements

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