Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

WebClient component

Updated on October 19, 2022

Use the WebClient component and its properties, methods, and events to use a Web resource in your automations.

The following tables describe the properties, methods, and events for the WebClient component.

Properties

PropertyDescription
AllowReadStreamBufferingGets or sets a value that indicates whether to buffer the data read from the Internet resource for a WebClient instance.
AllowWriteStreamBufferingGets or sets a value that indicates whether to buffer the data written to the Internet resource for a WebClient instance.
BaseAddressGets or sets the base URI for requests made by a WebClient.
CachePolicyGets or sets the application's cache policy for any resources obtained by this WebClient instance using WebRequest objects.
CredentialsGets or sets the network credentials that are sent to the host and used to authenticate the request.
EncodingGets or sets the Encoding used to upload and download strings.
HeadersGets or sets a collection of header name or value pairs associated with the request.
IsBusyIdentifies if a Web request is in progress.
ProxyGets or sets the proxy used by this WebClient object.
QueryStringGets or sets a collection of query names or value pairs associated with the request.
ResponseHeadersGets a collection of header names or value pairs associated with the response.
ThisA reference to this object.
UseDefaultCredentialsGets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.

Methods

MethodDescription
CancelAsyncCancels a pending asynchronous operation. If no asynchronous operation is in progress, this method does nothing.
DownloadData (String or URI)Downloads the resource as a Byte array from the URI, which is specified as either a string or a URI.
DownloadDataAsync (URI)Downloads the resource as a Byte array from the URI specified as an asynchronous operation.
DownloadDataAsync (URI, object)Downloads the resource as a Byte array from the URI specified as an asynchronous operation. The object is a user-defined object that is passed to the method invoked when the asynchronous operation completes.
DownloadDataTaskAsync (String, URI)Downloads the resource as a Byte array from the URI specified as an asynchronous operation using a task object. The resource can be specified as either a string or a URI.
DownloadFile (URI, string)Downloads the resource with the specified URI to a local file. Parameters are the URI from which to download data and the name of the local file to receive the data.
DownloadFile (string, string)Downloads the resource with the specified URI to a local file. Parameters are the URI from which to download data and the name of the local file to receive the data.
DownloadFileAsync (URI, string)Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread. Parameters are the URI of the resource to download and the name of the file to be placed on the local computer.
DownloadFileAsync (URI, string, object)Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread. Parameters are: the resource to download, the name of the file to be placed on the local computer, and a user-defined object that is passed to the method invoked when the asynchronous operation completes.
DownloadFileTaskAsync (string, string)Downloads the specified resource to a local file as an asynchronous operation using a task object. Parameters are the URI of the resource to download and the name of the file to be placed on the local computer.
DownloadFileTaskAsync (URI, string)Downloads the specified resource to a local file as an asynchronous operation using a task object. Parameters are the URI of the resource to download and the name of the file to be placed on the local computer.
DownloadString (String or URI)Downloads the requested resource as a String. The resource to download may be specified as either String containing the URI or a Uri.
DownloadStringAsync (URI)Downloads the resource specified as a Uri. This method does not block the calling thread.
DownloadStringAsync (URI, object)Downloads the specified string to the specified resource. This method does not block the calling thread. Parameters are the URI to download and a user-defined object that is passed to the method invoked when the asynchronous operation completes.
DownloadStringTaskAsync (string, URI)Downloads the resource as an asynchronous operation using a task object. The resource can be specified as either a string or a URI. These methods do not block the calling thread.
OpenRead (String or URI)Opens a readable stream for the data downloaded from a resource with the URI specified as either a String or a URI.
OpenReadAsync(Uri)Opens a readable stream containing the specified resource. This method does not block the calling thread. The parameter is the URI of the resource to retrieve.
OpenReadAsync(Uri, Object)Opens a readable stream containing the specified resource. This method does not block the calling thread. The parameter is the URI of the resource to retrieve and a user-defined object that is passed to the method invoked when the asynchronous operation completes.
OpenReadTaskAsync (String, URI)Opens a readable stream containing the specified resource as an asynchronous operation using a task object. The resource is identified as either a string or URI. These methods do not block the calling thread.
OpenWrite (string)Opens a stream for writing data to the specified resource.
OpenWrite (URI)Opens a stream for writing data to the specified resource.
OpenWrite (String, string)Opens a stream for writing data to the specified resource, using the specified method.
OpenWrite (URI, string)Opens a stream for writing data to the specified resource, by using the specified method.
OpenWriteAsync (URI)Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread.
OpenWriteAsync(Uri, String)Opens a stream for writing data to the specified resource. This method does not block the calling thread.
OpenWriteAsync(Uri, String, Object)Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread.
OpenWriteTaskAsync (string)Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
OpenWriteTaskAsync (Uri)Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
OpenWriteTaskAsync(String, String)Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
OpenWriteTaskAsync(Uri, String)Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
ResetStateResets all component properties to their initial values.
UploadData (String, Byte[])Uploads a data buffer to a resource identified by a URI.
UploadData (Uri, Byte[])Uploads a data buffer to a resource identified by a URI.
UploadData (String, String, Byte[])Uploads a data buffer to the specified resource, using the specified method.
UploadData (Uri, String, Byte[])Uploads a data buffer to the specified resource, using the specified method.
UploadDataAsync (Uri, String, Byte[])Uploads a data buffer to a resource identified by a URI, using the specified method. This method does not block the calling thread.
UploadDataAsync (Uri, String, Byte[], Object)Uploads a data buffer to a resource identified by a URI, using the specified method and identifying token.
UploadDataAsync (Uri, Byte[])Uploads a data buffer to a resource identified by a URI, using the POST method. This method does not block the calling thread.
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[])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[])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[])Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.
UploadFile (String, String)Uploads the specified local file to a resource with the specified URI.
UploadFile (Uri, String)Uploads the specified local file to a resource with the specified URI.
UploadFile (String, String, String)Uploads the specified local file to the specified resource, using the specified method.
UploadFile (Uri, String, String)Uploads the specified local file to the specified resource, using the specified method.
UploadFileAsync (Uri, String)Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.
UploadFileAsync (Uri, String, String)Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.
UploadFileAsync (Uri, String, String, Object)Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.
UploadFileTaskAsync (Uri, String, String)Uploads the specified local file to a resource as an asynchronous operation using a task object.
UploadFileTaskAsync (String, String, String)Uploads the specified local file to a resource as an asynchronous operation using a task object.
UploadFileTaskAsync (String, String)Uploads the specified local file to a resource as an asynchronous operation using a task object.
UploadFileTaskAsync (Uri, String)Uploads the specified local file to a resource as an asynchronous operation using a task object.
UploadString (String, String)Uploads the specified string to the specified resource, using the POST method.
UploadString (Uri, String)Uploads the specified string to the specified resource, using the POST method.
UploadString(String, String, String)Uploads the specified string to the specified resource, using the specified method.
UploadString(Uri, String, String)Uploads the specified string to the specified resource, using the specified method.
UploadStringAsync(Uri, String)Uploads the specified string to the specified resource. This method does not block the calling thread.
UploadStringAsync(Uri, String, String)Uploads the specified string to the specified resource. This method does not block the calling thread.
UploadStringAsync(Uri, String, String, Object)Uploads the specified string to the specified resource. This method does not block the calling thread.
UploadStringTaskAsync(Uri, String, String)Uploads the specified string to the specified resource as an asynchronous operation using a task object.
UploadStringTaskAsync(String, String, String)Uploads the specified string to the specified resource as an asynchronous operation using a task object.
UploadStringTaskAsync(String, String)Uploads the specified string to the specified resource as an asynchronous operation using a task object.
UploadStringTaskAsync(Uri, String)Uploads the specified string to the specified resource as an asynchronous operation using a task object.
UploadValues(String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI.
UploadValues(Uri, NameValueCollection) Uploads the specified name/value collection to the resource identified by the specified URI.
UploadValues(String, String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.
UploadValues(Uri, String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.
UploadValuesAsync(Uri, NameValueCollection)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.
UploadValuesAsync(Uri, String, NameValueCollection)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.
UploadValuesAsync(Uri, String, NameValueCollection, Object)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.
UploadValuesTaskAsync(String, String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.
UploadValuesTaskAsync(String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.
UploadValuesTaskAsync(Uri, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.
UploadValuesTaskAsync(Uri, String, NameValueCollection)Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.

Events

EventDescription
DownloadDataCompletedOccurs when an asynchronous data download operation completes.
DownloadFileCompletedOccurs when an asynchronous file download operation completes.
DownloadProgressChangedOccurs when an asynchronous download operation successfully transfers some or all of the data.
DownloadStringCompletedOccurs when an asynchronous resource-download operation completes.
OpenReadCompletedOccurs when an asynchronous operation to open a stream containing a resource completes.
OpenWriteCompletedOccurs when an asynchronous operation to open a stream to write data to a resource completes.
UploadDataCompletedOccurs when an asynchronous data-upload operation completes.
UploadFileCompletedOccurs when an asynchronous file-upload operation completes.
UploadProgressChangedOccurs when an asynchronous upload operation successfully transfers some or all of the data.
UploadStringCompletedOccurs when an asynchronous string-upload operation completes.
UploadValuesCompletedOccurs when an asynchronous upload of a name/value collection completes.
WriteStreamClosedOccurs when an asynchronous operation to write data to a resource using a write stream is closed.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us