SafeWebClient

SafeWebClient is used to make safe and secure web requests from scripting.

Example: Old request and response format

var webClient = new System.Net.WebClient();
var webClientResults = webClient.UploadString("https://httpbin.org/post", "POST", "This is the post body");
Example: New request and response format

var safeWebClient = new VisionCritical.PanelPlus.Responding.SafeWebClient();
var safeWebClientResults = safeWebClient.UploadString("https://httpbin.org/post", "POST", "This is the post body");

Usage

Namespace

VisionCritical.PanelPlus.Responding

Constructor

SafeWebClient()

Example

SafeWebClient safeWebClient = new VisionCritical.PanelPlus.Responding.SafeWebClient();

Properties inherited from WebClient:

Name Type Description
BaseAddress string Gets or sets the base URI for requests made by a SafeWebClient.
CachePolicy RequestCachePolicy Gets or sets the application's cache policy for any resources obtained by this SafeWebClient instance using WebRequest objects.
Container IContainer Gets the IContainer that contains the Component.
Credentials ICredentials Gets or sets the network credentials that are sent to the host and used to authenticate the request.
Encoding Encoding A Encoding that is used to encode strings. The default value of this property is the encoding returned by Default
Headers WebHeaderCollection A WebHeaderCollection containing header name/value pairs associated with this request.
IsBusy bool Gets whether a Web request is in progress.
Proxy IWebProxy Gets or sets the proxy used by this SafeWebClient object.
QueryString NameValueCollection Gets or sets a collection of query name/value pairs associated with the request.
ResponseHeaders WebHeaderCollection Gets a collection of header name/value pairs associated with the response.
Site ISite Gets or sets the ISite of the Component.
UseDefaultCredentials bool Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.

Methods

Name Description Params ReturnType
CancelAsync() Cancels a pending asynchronous operation. (Inherited from WebClient.) void
CreateObjRef(requestedType) Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Name Type Description
requestedType Type The type of the object that the new ObjRef will reference.
System.Runtime.Remoting.ObjRef
Dispose() Releases all resources used by the Component.(Inherited from Component.) void
DownloadData(address) Downloads the resource as a Byte array from the URI specified. (Inherited from WebClient.)
Name Type Description
address string The URI from which to download data.
System.Byte[]: A Byte array containing the downloaded resource.
DownloadDataAsync(uri) Downloads the resource as a Byte array from the URI specified as an asynchronous operation. (Inherited from WebClient.)
Name Type Description
uri System.Uri A Uri containing the URI to download.
void
Note: When the download completes, the DownloadDataCompleted event is raised. Your application must handle this event to receive notification. The downloaded data is available in the Result property.
DownloadDataAsync(uri, userToken) Downloads the resource as a Byte array from the URI specified as an asynchronous operation. (Inherited from WebClient.)
Name Type Description
uri System.Uri A Uri containing the URI to download.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
Note: When the download completes, the DownloadDataCompleted event is raised. Your application must handle this event to receive notification. The downloaded data is available in the Result property.
DownloadDataTaskAsync(address) Downloads the resource as a Byte array from the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to download.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the downloaded resource.
DownloadDataTaskAsync(Uri) Downloads the resource as a Byte array from the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
Uri System.Uri A Uri containing the URI to download.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the downloaded resource.
DownloadFile(address, fileName) Downloads the resource with the specified URI to a local file. (Inherited from WebClient.)
Name Type Description
address string The URI specified as a String from which to download data.
fileName string The name of the local file that is to receive the data.
void
DownloadFile(uri, fileName) Downloads the resource with the specified URI to a local file. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to download.
fileName string The name of the local file that is to receive the data.
void
Note: To receive notification when the file is available, add an event handler to the DownloadFileCompleted event.
DownloadFileAsync(address, fileName, userToken) Downloads the resource with the specified URI to a local file. (Inherited from WebClient.)
Name Type Description
address System.Uri The URI of the recourse to download
fileName string The name of the file to be placed on the local computer.
userToken System.Object A suer-defined object that is passed to the method invoked when the asynchronous operation completes.

void

Note: To receive notification when the file is available, add an event handler to the DownloadFileCompleted event.
DownloadFileTaskAsync(address, fileName) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to download.
fileName string The name of the file to be placed on the local computer.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation.
DownloadFileTaskAsync(uri, fileName) Downloads the specified resource to a local file as an asynchronous operation using a task object.
Name Type Description
uri System.Uri The URI of the resource to download.
fileName string The name of the file to be placed on the local computer.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation.
DownloadString(address) Downloads the requested resource as a String. The resource to download is specified as a String containing the URI. (Inherited from WebClient.)
Name Type Description
address string A string containing the URI to download.
System.String: A String containing the requested resource.
DownloadString(uri) Downloads the requested resource as a string. The resource to download is specified as a Uri. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to download.
System.String: A string containing the requested resource.
DownloadStringAsync Method(uri) Downloads the resource specified as a Uri. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to download.
void
DownloadStringAsync Method(uri, userToken) Downloads the specified string to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to download.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
DownloadStringTaskAsync(address) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to download.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The result property on the task object returns a byte array containing the downloaded resource.
DownloadStringTaskAsync(uri) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to download.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The result property on the task object returns a byte array containing the downloaded resource.
Equals(obj) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object. (Inherited from System.Object.)
Name Type Description
obj System.Object Determines whether the specified object is equal to the current object.
System.Boolean: The object to compare with the current object.
GetHashCode() Serves as the default hash function. (Inherited from System.Object .) System.Int32: A hash code for the current object.
GetLifetimeService() Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) System.Object: An object of type ILease used to control the lifetime policy for this instance.
GetType() Gets the Type of the current instance. (Inherited from System.Object.) System.Int32:: The exact runtime type of the current instance.
InitializeLifetimeService() Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from System.Object.) System.Object: An object of type ILease used to control the lifetime policy for this instance. This is the current lifetime service object for this instance if one exists; otherwise, a new lifetime service object initialized to the value of the LifetimeServices.LeaseManagerPollTime property.
OpenRead(address) Opens a readable stream for the data downloaded from a resource with the URI specified as a String. (Inherited from WebClient.)
Name Type Description
address string The URI specified as a String from which to download data.
System.IO.Stream: A stream used to read data from a resource.
OpenRead(uri) Opens a readable stream for the data downloaded from a resource with the URI specified as a String. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI specified as a Uri from which to download data.
System.IO.Stream: A Stream used to read data from a resource.
OpenReadAsync(uri) Opens a readable stream containing the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI specified as a Uri from which to download data.
void
Note: To receive notification when the file is available, add an event handler to the OpenReadCompleted event.
OpenReadAsync(uri, userToken) Opens a readable stream containing the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI specified as a Uri from which to download data.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
Note: To receive notification when the file is available, add an event handler to the OpenReadCompleted event.
OpenReadTaskAsync(address) Opens a readable stream containing the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to retrieve.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to read data from a resource.
OpenReadTaskAsync(uri) Opens a readable stream containing the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI specified as a Uri from which to download data.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to read data from a resource.
OpenWrite(address) Opens a readable stream containing the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to retrieve.
System.IO.Stream: A Stream used to write data to the resource.
OpenWrite(address, method) Opens a stream for writing data to the specified resource, using the specified method. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to retrieve.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
System.IO.Stream: A Stream used to write data to the resource.
OpenWrite(uri) Opens a stream for writing data to the specified resource. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
System.IO.Stream: A Stream used to write data to the resource.
OpenWrite(uri, method) Opens a stream for writing data to the specified resource, by using the specified method. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI specified as a Uri from which to download data.
address string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
System.IO.Stream
OpenWriteAsync(uri) Opens a stream for writing data to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
void
Note: To receive notification when the file is available, add an event handler to the OpenWriteCompleted event.
OpenWriteAsync(uri, method) Opens a stream for writing data to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
void
Note: To receive notification when the file is available, add an event handler to the OpenWriteCompleted event.
OpenWriteAsync(uri, method, userToken) Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
Note: To receive notification when the file is available, add an event handler to the OpenWriteCompleted event.
OpenWriteTaskAsync(address) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to write data to the resource.
OpenWriteTaskAsync(address, method) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to write data to the resource.
OpenWriteTaskAsync(uri) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to write data to the resource.
OpenWriteTaskAsync(uri, method) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri System.Uri The URI of the resource to receive the data.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
System.Threading.Tasks.Task<Stream>: The task object representing the asynchronous operation. The Result property on the task object returns a Stream used to write data to the resource.
ToString() Returns a string containing the name of the component, if any. This method should not be overridden. (Inherited from Component.) System.String: A String containing the name of the Component, if any, or null if the Component is unnamed.
UploadData(address, data) Uploads a data buffer to a resource identified by a URI. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
data byte[] The data buffer to send to the resource.
System.Byte[] : A Byte array containing the body of the response from the resource.
UploadData(address, method, data) Uploads a data buffer to the specified resource, using the specified method. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
method 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.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadData(uri, data) Uploads a data buffer to a resource identified by a URI. (Inherited from WebClient.)
Name Type Description
uri sting The URI of the resource to receive the data
data byte[] The data buffer to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadData(uri, method, data) Uploads a data buffer to the specified resource, using the specified method. (Inherited from WebClient.)
Name Type Description
uri string The URI of the resource to receive the data.
method 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.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadDataAsync(uri, data) Uploads a data buffer to a resource identified by a URI, using the POST method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the data.
data byte[] The data buffer to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
Note: To receive notification when the file is available, add an event handler to the UploadDataCompleted event.
UploadDataAsync(uri, method, data) Uploads a data buffer to a resource identified by a URI, using the specified method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the data.
method 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.
System.Byte[]: A Byte array containing the body of the response from the resource.
Note: To receive notification when the file is available, add an event handler to the UploadDataCompleted event.
UploadDataTaskAsync(address, data) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
data byte[] The data buffer to send to the resource.
System.Threading.Tasks.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.
UploadDataTaskAsync(address, method, data) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the data.
method 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.
System.Threading.Tasks.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.
UploadDataTaskAsync(uri, data) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the data.
data byte[] The data buffer to send to the resource.
System.Threading.Tasks.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.
UploadDataTaskAsync(uri, method, data) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the data.
method 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.
System.Threading.Tasks.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.
UploadFile(address, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadFile(address, method, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadFile(uri, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadFile(uri, method, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadFile(uri, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: -A Byte array containing the body of the response from the resource.
UploadFile(uri, method, filename) Uploads the specified local file to a resource with the specified URI. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadFileAsync(uri, filename) Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
void
Note: To receive notification when the file is available, add an event handler to the UploadFileCompleted event.
UploadFileAsync(uri, method, filename) Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
void
Note: To receive notification when the file is available, add an event handler to the UploadFileCompleted event.
UploadFileAsync(uri, method, filename, userToken) Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
Note: To receive notification when the file is available, add an event handler to the UploadFileCompleted event.
UploadFileTaskAsync(address, filename) Uploads the specified local file to a resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Threading.Tasks.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 file was uploaded.
UploadFileTaskAsync(address, method, filename) Uploads the specified local file to a resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Threading.Tasks.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 file was uploaded.
UploadFileTaskAsync(uri, filename) Uploads the specified local file to a resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Threading.Tasks.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 file was uploaded.
UploadFileTaskAsync(uri, method, filename) Uploads the specified local file to a resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
filename string The file to send to the resource. For example, "samplefile.txt".
System.Threading.Tasks.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 file was uploaded.
UploadString(address, data) Uploads the specified string to the specified resource, using the POST method. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
data string The string to be uploaded.
System.String: A String containing the response sent by the server.
UploadString(address, method, data) Uploads the specified string to the specified resource, using the specified method. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
System.String: A String containing the response sent by the server.
UploadString(uri, data) Uploads the specified string to the specified resource, using the POST method. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
data string The string to be uploaded.
System.String: A String containing the response sent by the server.
UploadString(uri, method, data) Uploads the specified string to the specified resource, using the specified method. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
System.String: A String containing the response sent by the server.
UploadStringAsync(uri, data) Uploads the specified string to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
data string The string to be uploaded.

void

Note: To receive notification when the file is available, add an event handler to the UploadStringCompleted event.
UploadStringAsync(uri, method, data) Uploads the specified string to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
void
Note: To receive notification when the file is available, add an event handler to the UploadStringCompleted event.
UploadStringAsync(uri, method, data, userToken) Uploads the specified string to the specified resource. This method does not block the calling thread. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.

void

Note: To receive notification when the file is available, add an event handler to the UploadStringCompleted event.
UploadStringAsyncTask(address, data) Uploads the specified string to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
data string The string to be uploaded.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The Result property on the task object returns a String containing the response sent by the server.
UploadStringAsyncTask(address, method, data) Uploads the specified string to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The Result property on the task object returns a String containing the response sent by the server.
UploadStringAsyncTask(uri, data) Uploads the specified string to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri string The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
data string The string to be uploaded.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The Result property on the task object returns a String containing the response sent by the server.
UploadStringAsyncTask(uri, method, data) Uploads the specified string to the specified resource as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data string The string to be uploaded.
System.Threading.Tasks.Task<String>: The task object representing the asynchronous operation. The Result property on the task object returns a String containing the response sent by the server.
UploadValues(address, data) Uploads the specified name/value collection to the resource identified by the specified URI. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the collection.
data NameValueCollection The NameValueCollection to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadValues(address, method, data) Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data NameValueCollection The NameValueCollection to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadValues(uri, data) Uploads the specified name/value collection to the resource identified by the specified URI. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
data NameValueCollection The NameValueCollection to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadValues(uri, method, data) Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
name NameValueCollection The NameValueCollection to send to the resource.
System.Byte[]: A Byte array containing the body of the response from the resource.
UploadValuesAsync(uri, data)

Uploads the data in the specified name/value collection to the resource identified by the specified URI. This method does not block the calling thread. (Inherited from WebClient.)

Name Type Description
uri uri The URI of the resource to receive the collection.
data NameValueCollection The NameValueCollection to send to the resource.
void
Note: To receive notification when the file is available, add an event handler to the UploadValuesCompleted event.
UploadValuesAsync(uri, method, data) Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread.(Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data NameValueCollection The NameValueCollection to send to the resource.
void
Note: To receive notification when the file is available, add an event handler to the UploadValuesCompleted event.
UploadValuesAsync(uri, method, data, userToken) Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread, and allows the caller to pass an object to the method that is invoked when the operation completes. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
userToken System.Object A user-defined object that is passed to the method invoked when the asynchronous operation completes.
void
Note: To receive notification when the file is available, add an event handler to the UploadValuesCompleted event.
UploadValuesTaskAsync(address, data) Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the collection.
data NameValueCollection The NameValueCollection to send to the resource.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the response sent by the server.
UploadValuesTaskAsync(address, method, data) Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
address string The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data NameValueCollection The NameValueCollection to send to the resource.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the response sent by the server.
UploadValuesTaskAsync(uri, data) Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
data NameValueCollection The NameValueCollection to send to the resource.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the response sent by the server.
UploadValuesTaskAsync(uri, method, data) Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. (Inherited from WebClient.)
Name Type Description
uri uri The URI of the resource to receive the collection.
method string The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
data NameValueCollection The NameValueCollection to send to the resource.
System.Threading.Tasks.Task<Byte[]>: The task object representing the asynchronous operation. The Result property on the task object returns a Byte array containing the response sent by the server.

Events

Name Description
DownloadDataCompleted

Occurs when an asynchronous data download operation completes.

Note: Asynchronous data downloads are started by calling the DownloadDataAsync methods. The DownloadDataCompletedEventHandler is the delegate for this event.
DownloadFileCompleted

Occurs when an asynchronous file download operation completes.

Note: Asynchronous data downloads are started by calling the DownloadDataAsync methods. The AsyncCompletedEventHandler is the delegate for this event. The AsyncCompletedEventArgs class provides the event handler with event data.
DownloadProgressChanged

Occurs when an asynchronous download operation successfully transfers some or all of the data.

Note: This event is raised each time an asynchronous download makes progress. This event is raised when downloads are started using any of the following methods.
  • DownloadDataAsync
  • DownloadFileAsync
  • OpenReadAsync

The DownloadProgressChangedEventHandler is the delegate for this event. The DownloadProgressChangedEventArgs class provides the event handler with event data.

DownloadStringCompleted

Occurs when an asynchronous resource-download operation completes.

Note:

These operations are started by calling the DownloadDataAsync methods.

The DownloadStringCompletedEventHandler is the delegate for this event. The DownloadStringCompletedEventArgs class provides the event handler with event data.

OpenReadCompleted

Occurs when an asynchronous operation to open a stream containing a resource completes.

Note: These operations are started by calling the OpenReadAsync methods.

The OpenReadCompletedEventHandler is the delegate for this event. The OpenReadCompletedEventArgs class provides the event handler with event data.

OpenWriteCompleted

Occurs when an asynchronous operation to open a stream to write data to a resource completes.

Note:

These operations are started by calling the OpenWriteAsync methods.

The OpenWriteCompletedEventHandler is the delegate for this event. The OpenWriteCompletedEventArgs class provides the event handler with event data.

UploadDataCompleted

Occurs when an asynchronous data-upload operation completes.

Note: These operations are started by calling the UploadDataAsync methods.

The UploadDataCompletedEventHandler is the delegate for this event. The UploadDataCompletedEventArgs class provides the event handler with event data.

UploadFileCompleted

Occurs when an asynchronous file-upload operation completes.

Note: These operations are started by calling the UploadFileAsync methods.

The UploadFileCompletedEventHandler is the delegate for this event. The UploadFileCompletedEventArgs class provides the event handler with event data.

UploadProgressChanged

Occurs when an asynchronous upload operation successfully transfers some or all of the data.

Note: This event is raised each time an asynchronous upload makes progress. This event is raised when uploads are started using any of the following methods.
  • UploadDataAsync
  • UploadFileAsync
  • UploadValuesAsync

The UploadFileUploadProgressChangedEventHandlerAsync is the delegate for this event. The UploadProgressChangedEventArgs class provides the event handler with event data.

UploadStringCompleted

Occurs when an asynchronous string-upload operation completes.

Note: These operations are started by calling the UploadStringAsync methods.

The UploadStringCompletedEventHandler is the delegate for this event. The UploadStringCompletedEventArgs class provides the event handler with event data.

UploadValuesCompleted

Occurs when an asynchronous string-upload operation completes.

Note: These operations are started by calling the UploadValuesAsync methods.

The UploadValuesCompletedEventHandler is the delegate for this event. The UploadValuesCompletedEventArgs class provides the event handler with event data.