mscorlib(4.0.0.0) API with additions
System.Net.WebClient Class Reference

Provides common methods for sending data to and receiving data from a resource identified by a URI. More...

Inheritance diagram for System.Net.WebClient:
[legend]
Collaboration diagram for System.Net.WebClient:
[legend]

Public Member Functions

 WebClient ()
 Initializes a new instance of the T:System.Net.WebClient class. More...
 
byte [] DownloadData (string address)
 Downloads the resource as a T:System.Byte array from the URI specified. More...
 
byte [] DownloadData (Uri address)
 Downloads the resource as a T:System.Byte array from the URI specified. More...
 
void DownloadFile (string address, string fileName)
 Downloads the resource with the specified URI to a local file. More...
 
void DownloadFile (Uri address, string fileName)
 Downloads the resource with the specified URI to a local file. More...
 
Stream OpenRead (string address)
 Opens a readable stream for the data downloaded from a resource with the URI specified as a T:System.String. More...
 
Stream OpenRead (Uri address)
 Opens a readable stream for the data downloaded from a resource with the URI specified as a T:System.Uri More...
 
Stream OpenWrite (string address)
 Opens a stream for writing data to the specified resource. More...
 
Stream OpenWrite (Uri address)
 Opens a stream for writing data to the specified resource. More...
 
Stream OpenWrite (string address, string method)
 Opens a stream for writing data to the specified resource, using the specified method. More...
 
Stream OpenWrite (Uri address, string method)
 Opens a stream for writing data to the specified resource, by using the specified method. More...
 
byte [] UploadData (string address, byte[] data)
 Uploads a data buffer to a resource identified by a URI. More...
 
byte [] UploadData (Uri address, byte[] data)
 Uploads a data buffer to a resource identified by a URI. More...
 
byte [] UploadData (string address, string method, byte[] data)
 Uploads a data buffer to the specified resource, using the specified method. More...
 
byte [] UploadData (Uri address, string method, byte[] data)
 Uploads a data buffer to the specified resource, using the specified method. More...
 
byte [] UploadFile (string address, string fileName)
 Uploads the specified local file to a resource with the specified URI. More...
 
byte [] UploadFile (Uri address, string fileName)
 Uploads the specified local file to a resource with the specified URI. More...
 
byte [] UploadFile (string address, string method, string fileName)
 Uploads the specified local file to the specified resource, using the specified method. More...
 
byte [] UploadFile (Uri address, string method, string fileName)
 Uploads the specified local file to the specified resource, using the specified method. More...
 
byte [] UploadValues (string address, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI. More...
 
byte [] UploadValues (Uri address, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI. More...
 
byte [] UploadValues (string address, string method, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method. More...
 
byte [] UploadValues (Uri address, string method, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method. More...
 
string UploadString (string address, string data)
 Uploads the specified string to the specified resource, using the POST method. More...
 
string UploadString (Uri address, string data)
 Uploads the specified string to the specified resource, using the POST method. More...
 
string UploadString (string address, string method, string data)
 Uploads the specified string to the specified resource, using the specified method. More...
 
string UploadString (Uri address, string method, string data)
 Uploads the specified string to the specified resource, using the specified method. More...
 
string DownloadString (string address)
 Downloads the requested resource as a T:System.String. The resource to download is specified as a T:System.String containing the URI. More...
 
string DownloadString (Uri address)
 Downloads the requested resource as a T:System.String. The resource to download is specified as a T:System.Uri. More...
 
void OpenReadAsync (Uri address)
 Opens a readable stream containing the specified resource. This method does not block the calling thread. More...
 
void OpenReadAsync (Uri address, object userToken)
 Opens a readable stream containing the specified resource. This method does not block the calling thread. More...
 
void OpenWriteAsync (Uri address)
 Opens a stream for writing data to the specified resource. This method does not block the calling thread. More...
 
void OpenWriteAsync (Uri address, string method)
 Opens a stream for writing data to the specified resource. This method does not block the calling thread. More...
 
void OpenWriteAsync (Uri address, string method, object userToken)
 Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread. More...
 
void DownloadStringAsync (Uri address)
 Downloads the resource specified as a T:System.Uri. This method does not block the calling thread. More...
 
void DownloadStringAsync (Uri address, object userToken)
 Downloads the specified string to the specified resource. This method does not block the calling thread. More...
 
void DownloadDataAsync (Uri address)
 Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation. More...
 
void DownloadDataAsync (Uri address, object userToken)
 Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation. More...
 
void DownloadFileAsync (Uri address, string fileName)
 Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread. More...
 
void DownloadFileAsync (Uri address, string fileName, object userToken)
 Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread. More...
 
void UploadStringAsync (Uri address, string data)
 Uploads the specified string to the specified resource. This method does not block the calling thread. More...
 
void UploadStringAsync (Uri address, string method, string data)
 Uploads the specified string to the specified resource. This method does not block the calling thread. More...
 
void UploadStringAsync (Uri address, string method, string data, object userToken)
 Uploads the specified string to the specified resource. This method does not block the calling thread. More...
 
void UploadDataAsync (Uri address, byte[] data)
 Uploads a data buffer to a resource identified by a URI, using the POST method. This method does not block the calling thread. More...
 
void UploadDataAsync (Uri address, string method, byte[] data)
 Uploads a data buffer to a resource identified by a URI, using the specified method. This method does not block the calling thread. More...
 
void UploadDataAsync (Uri address, string method, byte[] data, object userToken)
 Uploads a data buffer to a resource identified by a URI, using the specified method and identifying token. More...
 
void UploadFileAsync (Uri address, string fileName)
 Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. More...
 
void UploadFileAsync (Uri address, string method, string fileName)
 Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. More...
 
void UploadFileAsync (Uri address, string method, string fileName, object userToken)
 Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread. More...
 
void UploadValuesAsync (Uri address, NameValueCollection 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. More...
 
void UploadValuesAsync (Uri address, string method, NameValueCollection 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. More...
 
void UploadValuesAsync (Uri address, string method, NameValueCollection data, object 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. More...
 
void CancelAsync ()
 Cancels a pending asynchronous operation. More...
 
Task< string > DownloadStringTaskAsync (string address)
 Downloads the resource as a T:System.String from the URI specified as an asynchronous operation using a task object. More...
 
Task< string > DownloadStringTaskAsync (Uri address)
 Downloads the resource as a T:System.String from the URI specified as an asynchronous operation using a task object. More...
 
Task< StreamOpenReadTaskAsync (string address)
 Opens a readable stream containing the specified resource as an asynchronous operation using a task object. More...
 
Task< StreamOpenReadTaskAsync (Uri address)
 Opens a readable stream containing the specified resource as an asynchronous operation using a task object. More...
 
Task< StreamOpenWriteTaskAsync (string address)
 Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. More...
 
Task< StreamOpenWriteTaskAsync (Uri address)
 Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. More...
 
Task< StreamOpenWriteTaskAsync (string address, string method)
 Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. More...
 
Task< StreamOpenWriteTaskAsync (Uri address, string method)
 Opens a stream for writing data to the specified resource as an asynchronous operation using a task object. More...
 
Task< string > UploadStringTaskAsync (string address, string data)
 Uploads the specified string to the specified resource as an asynchronous operation using a task object. More...
 
Task< string > UploadStringTaskAsync (Uri address, string data)
 Uploads the specified string to the specified resource as an asynchronous operation using a task object. More...
 
Task< string > UploadStringTaskAsync (string address, string method, string data)
 Uploads the specified string to the specified resource as an asynchronous operation using a task object. More...
 
Task< string > UploadStringTaskAsync (Uri address, string method, string data)
 Uploads the specified string to the specified resource as an asynchronous operation using a task object. More...
 
Task< byte[]> DownloadDataTaskAsync (string address)
 Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation using a task object. More...
 
Task< byte[]> DownloadDataTaskAsync (Uri address)
 Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation using a task object. More...
 
Task DownloadFileTaskAsync (string address, string fileName)
 Downloads the specified resource to a local file as an asynchronous operation using a task object. More...
 
Task DownloadFileTaskAsync (Uri address, string fileName)
 Downloads the specified resource to a local file as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadDataTaskAsync (string address, byte[] data)
 Uploads a data buffer that contains a T:System.Byte array to the URI specified as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadDataTaskAsync (Uri address, byte[] data)
 Uploads a data buffer that contains a T:System.Byte array to the URI specified as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadDataTaskAsync (string address, string method, byte[] data)
 Uploads a data buffer that contains a T:System.Byte array to the URI specified as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadDataTaskAsync (Uri address, string method, byte[] data)
 Uploads a data buffer that contains a T:System.Byte array to the URI specified as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadFileTaskAsync (string address, string fileName)
 Uploads the specified local file to a resource as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadFileTaskAsync (Uri address, string fileName)
 Uploads the specified local file to a resource as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadFileTaskAsync (string address, string method, string fileName)
 Uploads the specified local file to a resource as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadFileTaskAsync (Uri address, string method, string fileName)
 Uploads the specified local file to a resource as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadValuesTaskAsync (string address, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadValuesTaskAsync (string address, string method, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadValuesTaskAsync (Uri address, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. More...
 
Task< byte[]> UploadValuesTaskAsync (Uri address, string method, NameValueCollection data)
 Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object. More...
 
- Public Member Functions inherited from System.ComponentModel.Component
void Dispose ()
 Releases all resources used by the T:System.ComponentModel.Component. More...
 
override string ToString ()
 Returns a T:System.String containing the name of the T:System.ComponentModel.Component, if any. This method should not be overridden. More...
 
- Public Member Functions inherited from System.MarshalByRefObject
object GetLifetimeService ()
 Retrieves the current lifetime service object that controls the lifetime policy for this instance. More...
 
virtual object InitializeLifetimeService ()
 Obtains a lifetime service object to control the lifetime policy for this instance. More...
 
virtual ObjRef CreateObjRef (Type requestedType)
 Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. More...
 

Public Attributes

bool IsBusy => m_AsyncOp != null
 Gets whether a Web request is in progress. More...
 

Protected Member Functions

virtual void OnWriteStreamClosed (WriteStreamClosedEventArgs e)
 Raises the E:System.Net.WebClient.WriteStreamClosed event. More...
 
virtual WebRequest GetWebRequest (Uri address)
 Returns a T:System.Net.WebRequest object for the specified resource. More...
 
virtual WebResponse GetWebResponse (WebRequest request)
 Returns the T:System.Net.WebResponse for the specified T:System.Net.WebRequest. More...
 
virtual WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
 Returns the T:System.Net.WebResponse for the specified T:System.Net.WebRequest using the specified T:System.IAsyncResult. More...
 
virtual void OnOpenReadCompleted (OpenReadCompletedEventArgs e)
 Raises the E:System.Net.WebClient.OpenReadCompleted event. More...
 
virtual void OnOpenWriteCompleted (OpenWriteCompletedEventArgs e)
 Raises the E:System.Net.WebClient.OpenWriteCompleted event. More...
 
virtual void OnDownloadStringCompleted (DownloadStringCompletedEventArgs e)
 Raises the E:System.Net.WebClient.DownloadStringCompleted event. More...
 
virtual void OnDownloadDataCompleted (DownloadDataCompletedEventArgs e)
 Raises the E:System.Net.WebClient.DownloadDataCompleted event. More...
 
virtual void OnDownloadFileCompleted (AsyncCompletedEventArgs e)
 Raises the E:System.Net.WebClient.DownloadFileCompleted event. More...
 
virtual void OnUploadStringCompleted (UploadStringCompletedEventArgs e)
 Raises the E:System.Net.WebClient.UploadStringCompleted event. More...
 
virtual void OnUploadDataCompleted (UploadDataCompletedEventArgs e)
 Raises the E:System.Net.WebClient.UploadDataCompleted event. More...
 
virtual void OnUploadFileCompleted (UploadFileCompletedEventArgs e)
 Raises the E:System.Net.WebClient.UploadFileCompleted event. More...
 
virtual void OnUploadValuesCompleted (UploadValuesCompletedEventArgs e)
 Raises the E:System.Net.WebClient.UploadValuesCompleted event. More...
 
virtual void OnDownloadProgressChanged (DownloadProgressChangedEventArgs e)
 Raises the E:System.Net.WebClient.DownloadProgressChanged event. More...
 
virtual void OnUploadProgressChanged (UploadProgressChangedEventArgs e)
 Raises the E:System.Net.WebClient.UploadProgressChanged event. More...
 
- Protected Member Functions inherited from System.ComponentModel.Component
virtual void Dispose (bool disposing)
 Releases the unmanaged resources used by the T:System.ComponentModel.Component and optionally releases the managed resources. More...
 
virtual object GetService (Type service)
 Returns an object that represents a service provided by the T:System.ComponentModel.Component or by its T:System.ComponentModel.Container. More...
 
- Protected Member Functions inherited from System.MarshalByRefObject
MarshalByRefObject MemberwiseClone (bool cloneIdentity)
 Creates a shallow copy of the current T:System.MarshalByRefObject object. More...
 

Properties

bool AllowReadStreamBuffering [get, set]
 Gets or sets a value that indicates whether to buffer the data read from the Internet resource for a T:System.Net.WebClient instance. More...
 
bool AllowWriteStreamBuffering [get, set]
 Gets or sets a value that indicates whether to buffer the data written to the Internet resource for a T:System.Net.WebClient instance. More...
 
Encoding Encoding [get, set]
 Gets and sets the T:System.Text.Encoding used to upload and download strings. More...
 
string BaseAddress [get, set]
 Gets or sets the base URI for requests made by a T:System.Net.WebClient. More...
 
ICredentials Credentials [get, set]
 Gets or sets the network credentials that are sent to the host and used to authenticate the request. More...
 
bool? UseDefaultCredentials [get, set]
 Gets or sets a T:System.Boolean value that controls whether the P:System.Net.CredentialCache.DefaultCredentials are sent with requests. More...
 
WebHeaderCollection Headers [get, set]
 Gets or sets a collection of header name/value pairs associated with the request. More...
 
NameValueCollection QueryString [get, set]
 Gets or sets a collection of query name/value pairs associated with the request. More...
 
WebHeaderCollection ResponseHeaders [get]
 Gets a collection of header name/value pairs associated with the response. More...
 
IWebProxy Proxy [get, set]
 Gets or sets the proxy used by this T:System.Net.WebClient object. More...
 
RequestCachePolicy CachePolicy [get, set]
 Gets or sets the application's cache policy for any resources obtained by this WebClient instance using T:System.Net.WebRequest objects. More...
 
WriteStreamClosedEventHandler WriteStreamClosed
 Occurs when an asynchronous operation to write data to a resource using a write stream is closed. More...
 
- Properties inherited from System.ComponentModel.Component
EventHandlerList Events [get]
 Gets the list of event handlers that are attached to this T:System.ComponentModel.Component. More...
 
virtual ISite Site [get, set]
 Gets or sets the T:System.ComponentModel.ISite of the T:System.ComponentModel.Component. More...
 
IContainerContainer [get]
 Gets the T:System.ComponentModel.IContainer that contains the T:System.ComponentModel.Component. More...
 
bool??? DesignMode [get]
 Gets a value that indicates whether the T:System.ComponentModel.Component is currently in design mode. More...
 
EventHandler Disposed
 Occurs when the component is disposed by a call to the M:System.ComponentModel.Component.Dispose method. More...
 
- Properties inherited from System.ComponentModel.IComponent
ISite Site [get, set]
 Gets or sets the T:System.ComponentModel.ISite associated with the T:System.ComponentModel.IComponent. More...
 

Events

OpenReadCompletedEventHandler OpenReadCompleted
 Occurs when an asynchronous operation to open a stream containing a resource completes. More...
 
OpenWriteCompletedEventHandler OpenWriteCompleted
 Occurs when an asynchronous operation to open a stream to write data to a resource completes. More...
 
DownloadStringCompletedEventHandler DownloadStringCompleted
 Occurs when an asynchronous resource-download operation completes. More...
 
DownloadDataCompletedEventHandler DownloadDataCompleted
 Occurs when an asynchronous data download operation completes. More...
 
AsyncCompletedEventHandler DownloadFileCompleted
 Occurs when an asynchronous file download operation completes. More...
 
UploadStringCompletedEventHandler UploadStringCompleted
 Occurs when an asynchronous string-upload operation completes. More...
 
UploadDataCompletedEventHandler UploadDataCompleted
 Occurs when an asynchronous data-upload operation completes. More...
 
UploadFileCompletedEventHandler UploadFileCompleted
 Occurs when an asynchronous file-upload operation completes. More...
 
UploadValuesCompletedEventHandler UploadValuesCompleted
 Occurs when an asynchronous upload of a name/value collection completes. More...
 
DownloadProgressChangedEventHandler DownloadProgressChanged
 Occurs when an asynchronous download operation successfully transfers some or all of the data. More...
 
UploadProgressChangedEventHandler UploadProgressChanged
 Occurs when an asynchronous upload operation successfully transfers some or all of the data. More...
 
- Events inherited from System.ComponentModel.IComponent
EventHandler Disposed
 Represents the method that handles the E:System.ComponentModel.IComponent.Disposed event of a component. More...
 

Additional Inherited Members

- Protected Attributes inherited from System.ComponentModel.Component
virtual bool CanRaiseEvents => true
 Gets a value indicating whether the component can raise an event. More...
 

Detailed Description

Provides common methods for sending data to and receiving data from a resource identified by a URI.

Definition at line 17 of file WebClient.cs.

Constructor & Destructor Documentation

◆ WebClient()

System.Net.WebClient.WebClient ( )

Initializes a new instance of the T:System.Net.WebClient class.

Definition at line 804 of file WebClient.cs.

Member Function Documentation

◆ CancelAsync()

void System.Net.WebClient.CancelAsync ( )

Cancels a pending asynchronous operation.

Definition at line 3282 of file WebClient.cs.

◆ DownloadData() [1/2]

byte [] System.Net.WebClient.DownloadData ( string  address)

Downloads the resource as a T:System.Byte array from the URI specified.

Parameters
addressThe URI from which to download data.
Returns
A T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading data.
T:System.NotSupportedExceptionThe method has been called simultaneously on multiple threads.

Definition at line 916 of file WebClient.cs.

◆ DownloadData() [2/2]

byte [] System.Net.WebClient.DownloadData ( Uri  address)

Downloads the resource as a T:System.Byte array from the URI specified.

Parameters
addressThe URI represented by the T:System.Uri object, from which to download data.
Returns
A T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.

Definition at line 929 of file WebClient.cs.

◆ DownloadDataAsync() [1/2]

void System.Net.WebClient.DownloadDataAsync ( Uri  address)

Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation.

Parameters
addressA T:System.Uri containing the URI to download.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 2627 of file WebClient.cs.

◆ DownloadDataAsync() [2/2]

void System.Net.WebClient.DownloadDataAsync ( Uri  address,
object  userToken 
)

Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation.

Parameters
addressA T:System.Uri containing the URI to download.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 2638 of file WebClient.cs.

◆ DownloadDataTaskAsync() [1/2]

Task<byte[]> System.Net.WebClient.DownloadDataTaskAsync ( string  address)

Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 3534 of file WebClient.cs.

◆ DownloadDataTaskAsync() [2/2]

Task<byte[]> System.Net.WebClient.DownloadDataTaskAsync ( Uri  address)

Downloads the resource as a T:System.Byte array from the URI specified as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 3546 of file WebClient.cs.

◆ DownloadFile() [1/2]

void System.Net.WebClient.DownloadFile ( string  address,
string  fileName 
)

Downloads the resource with the specified URI to a local file.

Parameters
addressThe URI from which to download data.
fileNameThe name of the local file that is to receive the data.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- filename is null or F:System.String.Empty.-or-The file does not exist.-or- An error occurred while downloading data.
T:System.NotSupportedExceptionThe method has been called simultaneously on multiple threads.

Definition at line 991 of file WebClient.cs.

◆ DownloadFile() [2/2]

void System.Net.WebClient.DownloadFile ( Uri  address,
string  fileName 
)

Downloads the resource with the specified URI to a local file.

Parameters
addressThe URI specified as a T:System.String, from which to download data.
fileNameThe name of the local file that is to receive the data.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- filename is null or F:System.String.Empty.-or- The file does not exist. -or- An error occurred while downloading data.
T:System.NotSupportedExceptionThe method has been called simultaneously on multiple threads.

Definition at line 1007 of file WebClient.cs.

◆ DownloadFileAsync() [1/2]

void System.Net.WebClient.DownloadFileAsync ( Uri  address,
string  fileName 
)

Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.

Parameters
addressThe URI of the resource to download.
fileNameThe name of the file to be placed on the local computer.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.InvalidOperationExceptionThe local file specified by fileName is in use by another thread.

Definition at line 2703 of file WebClient.cs.

◆ DownloadFileAsync() [2/2]

void System.Net.WebClient.DownloadFileAsync ( Uri  address,
string  fileName,
object  userToken 
)

Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.

Parameters
addressThe URI of the resource to download.
fileNameThe name of the file to be placed on the local computer.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.InvalidOperationExceptionThe local file specified by fileName is in use by another thread.

Definition at line 2716 of file WebClient.cs.

◆ DownloadFileTaskAsync() [1/2]

Task System.Net.WebClient.DownloadFileTaskAsync ( string  address,
string  fileName 
)

Downloads the specified resource to a local file as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
fileNameThe name of the file to be placed on the local computer.
Returns
Returns T:System.Threading.Tasks.Task.The task object representing the asynchronous operation.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.InvalidOperationExceptionThe local file specified by fileName is in use by another thread.

Definition at line 3579 of file WebClient.cs.

◆ DownloadFileTaskAsync() [2/2]

Task System.Net.WebClient.DownloadFileTaskAsync ( Uri  address,
string  fileName 
)

Downloads the specified resource to a local file as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
fileNameThe name of the file to be placed on the local computer.
Returns
Returns T:System.Threading.Tasks.Task.The task object representing the asynchronous operation.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.InvalidOperationExceptionThe local file specified by fileName is in use by another thread.

Definition at line 3593 of file WebClient.cs.

◆ DownloadString() [1/2]

string System.Net.WebClient.DownloadString ( string  address)

Downloads the requested resource as a T:System.String. The resource to download is specified as a T:System.String containing the URI.

Parameters
addressA T:System.String containing the URI to download.
Returns
A T:System.String containing the requested resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.NotSupportedExceptionThe method has been called simultaneously on multiple threads.

Definition at line 1731 of file WebClient.cs.

◆ DownloadString() [2/2]

string System.Net.WebClient.DownloadString ( Uri  address)

Downloads the requested resource as a T:System.String. The resource to download is specified as a T:System.Uri.

Parameters
addressA T:System.Uri object containing the URI to download.
Returns
A T:System.String containing the requested resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.
T:System.NotSupportedExceptionThe method has been called simultaneously on multiple threads.

Definition at line 1746 of file WebClient.cs.

◆ DownloadStringAsync() [1/2]

void System.Net.WebClient.DownloadStringAsync ( Uri  address)

Downloads the resource specified as a T:System.Uri. This method does not block the calling thread.

Parameters
addressA T:System.Uri containing the URI to download.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 2553 of file WebClient.cs.

◆ DownloadStringAsync() [2/2]

void System.Net.WebClient.DownloadStringAsync ( Uri  address,
object  userToken 
)

Downloads the specified string to the specified resource. This method does not block the calling thread.

Parameters
addressA T:System.Uri containing the URI to download.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 2564 of file WebClient.cs.

◆ DownloadStringTaskAsync() [1/2]

Task<string> System.Net.WebClient.DownloadStringTaskAsync ( string  address)

Downloads the resource as a T:System.String from the URI specified as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 3296 of file WebClient.cs.

◆ DownloadStringTaskAsync() [2/2]

Task<string> System.Net.WebClient.DownloadStringTaskAsync ( Uri  address)

Downloads the resource as a T:System.String from the URI specified as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to download.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the downloaded resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource.

Definition at line 3308 of file WebClient.cs.

◆ GetWebRequest()

virtual WebRequest System.Net.WebClient.GetWebRequest ( Uri  address)
protectedvirtual

Returns a T:System.Net.WebRequest object for the specified resource.

Parameters
addressA T:System.Uri that identifies the resource to request.
Returns
A new T:System.Net.WebRequest object for the specified resource.

Definition at line 866 of file WebClient.cs.

◆ GetWebResponse() [1/2]

virtual WebResponse System.Net.WebClient.GetWebResponse ( WebRequest  request)
protectedvirtual

Returns the T:System.Net.WebResponse for the specified T:System.Net.WebRequest.

Parameters
requestA T:System.Net.WebRequest that is used to obtain the response.
Returns
A T:System.Net.WebResponse containing the response for the specified T:System.Net.WebRequest.

Definition at line 896 of file WebClient.cs.

◆ GetWebResponse() [2/2]

virtual WebResponse System.Net.WebClient.GetWebResponse ( WebRequest  request,
IAsyncResult  result 
)
protectedvirtual

Returns the T:System.Net.WebResponse for the specified T:System.Net.WebRequest using the specified T:System.IAsyncResult.

Parameters
requestA T:System.Net.WebRequest that is used to obtain the response.
resultAn T:System.IAsyncResult object obtained from a previous call to M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object) .
Returns
A T:System.Net.WebResponse containing the response for the specified T:System.Net.WebRequest.

Definition at line 905 of file WebClient.cs.

◆ OnDownloadDataCompleted()

virtual void System.Net.WebClient.OnDownloadDataCompleted ( DownloadDataCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.DownloadDataCompleted event.

Parameters
eA T:System.Net.DownloadDataCompletedEventArgs object that contains event data.

Definition at line 2602 of file WebClient.cs.

◆ OnDownloadFileCompleted()

virtual void System.Net.WebClient.OnDownloadFileCompleted ( AsyncCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.DownloadFileCompleted event.

Parameters
eAn T:System.ComponentModel.AsyncCompletedEventArgs object containing event data.

Definition at line 2676 of file WebClient.cs.

◆ OnDownloadProgressChanged()

virtual void System.Net.WebClient.OnDownloadProgressChanged ( DownloadProgressChangedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.DownloadProgressChanged event.

Parameters
eA T:System.Net.DownloadProgressChangedEventArgs object containing event data.

Definition at line 3870 of file WebClient.cs.

◆ OnDownloadStringCompleted()

virtual void System.Net.WebClient.OnDownloadStringCompleted ( DownloadStringCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.DownloadStringCompleted event.

Parameters
eA T:System.Net.DownloadStringCompletedEventArgs object containing event data.

Definition at line 2512 of file WebClient.cs.

◆ OnOpenReadCompleted()

virtual void System.Net.WebClient.OnOpenReadCompleted ( OpenReadCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.OpenReadCompleted event.

Parameters
eA T:System.Net.OpenReadCompletedEventArgs object containing event data.

Definition at line 2307 of file WebClient.cs.

◆ OnOpenWriteCompleted()

virtual void System.Net.WebClient.OnOpenWriteCompleted ( OpenWriteCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.OpenWriteCompleted event.

Parameters
eA T:System.Net.OpenWriteCompletedEventArgs object containing event data.

Definition at line 2402 of file WebClient.cs.

◆ OnUploadDataCompleted()

virtual void System.Net.WebClient.OnUploadDataCompleted ( UploadDataCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.UploadDataCompleted event.

Parameters
eA T:System.Net.UploadDataCompletedEventArgs object containing event data.

Definition at line 2917 of file WebClient.cs.

◆ OnUploadFileCompleted()

virtual void System.Net.WebClient.OnUploadFileCompleted ( UploadFileCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.UploadFileCompleted event.

Parameters
eAn T:System.Net.UploadFileCompletedEventArgs object containing event data.

Definition at line 3037 of file WebClient.cs.

◆ OnUploadProgressChanged()

virtual void System.Net.WebClient.OnUploadProgressChanged ( UploadProgressChangedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.UploadProgressChanged event.

Parameters
eAn T:System.Net.UploadProgressChangedEventArgs object containing event data.

Definition at line 3880 of file WebClient.cs.

◆ OnUploadStringCompleted()

virtual void System.Net.WebClient.OnUploadStringCompleted ( UploadStringCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.UploadStringCompleted event.

Parameters
eAn T:System.Net.UploadStringCompletedEventArgs object containing event data.

Definition at line 2761 of file WebClient.cs.

◆ OnUploadValuesCompleted()

virtual void System.Net.WebClient.OnUploadValuesCompleted ( UploadValuesCompletedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.UploadValuesCompleted event.

Parameters
eA T:System.Net.UploadValuesCompletedEventArgs object containing event data.

Definition at line 3161 of file WebClient.cs.

◆ OnWriteStreamClosed()

virtual void System.Net.WebClient.OnWriteStreamClosed ( WriteStreamClosedEventArgs  e)
protectedvirtual

Raises the E:System.Net.WebClient.WriteStreamClosed event.

Parameters
eA T:System.Net.WriteStreamClosedEventArgs object containing event data.

Definition at line 859 of file WebClient.cs.

◆ OpenRead() [1/2]

Stream System.Net.WebClient.OpenRead ( string  address)

Opens a readable stream for the data downloaded from a resource with the URI specified as a T:System.String.

Parameters
addressThe URI specified as a T:System.String from which to download data.
Returns
A T:System.IO.Stream used to read data from a resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, address is invalid.-or- An error occurred while downloading data.

Definition at line 1070 of file WebClient.cs.

◆ OpenRead() [2/2]

Stream System.Net.WebClient.OpenRead ( Uri  address)

Opens a readable stream for the data downloaded from a resource with the URI specified as a T:System.Uri

Parameters
addressThe URI specified as a T:System.Uri from which to download data.
Returns
A T:System.IO.Stream used to read data from a resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, address is invalid.-or- An error occurred while downloading data.

Definition at line 1084 of file WebClient.cs.

◆ OpenReadAsync() [1/2]

void System.Net.WebClient.OpenReadAsync ( Uri  address)

Opens a readable stream containing the specified resource. This method does not block the calling thread.

Parameters
addressThe URI of the resource to retrieve.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.

Definition at line 2352 of file WebClient.cs.

◆ OpenReadAsync() [2/2]

void System.Net.WebClient.OpenReadAsync ( Uri  address,
object  userToken 
)

Opens a readable stream containing the specified resource. This method does not block the calling thread.

Parameters
addressThe URI of the resource to retrieve.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.

Definition at line 2363 of file WebClient.cs.

◆ OpenReadTaskAsync() [1/2]

Task<Stream> System.Net.WebClient.OpenReadTaskAsync ( string  address)

Opens a readable stream containing the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to retrieve.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to read data from a resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.

Definition at line 3339 of file WebClient.cs.

◆ OpenReadTaskAsync() [2/2]

Task<Stream> System.Net.WebClient.OpenReadTaskAsync ( Uri  address)

Opens a readable stream containing the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to retrieve.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to read data from a resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.

Definition at line 3351 of file WebClient.cs.

◆ OpenWrite() [1/4]

Stream System.Net.WebClient.OpenWrite ( string  address)

Opens a stream for writing data to the specified resource.

Parameters
addressThe URI of the resource to receive the data.
Returns
A T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- An error occurred while opening the stream.

Definition at line 1131 of file WebClient.cs.

◆ OpenWrite() [2/4]

Stream System.Net.WebClient.OpenWrite ( Uri  address)

Opens a stream for writing data to the specified resource.

Parameters
addressThe URI of the resource to receive the data.
Returns
A T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- An error occurred while opening the stream.

Definition at line 1145 of file WebClient.cs.

◆ OpenWrite() [3/4]

Stream System.Net.WebClient.OpenWrite ( string  address,
string  method 
)

Opens a stream for writing data to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
Returns
A T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- An error occurred while opening the stream.

Definition at line 1156 of file WebClient.cs.

◆ OpenWrite() [4/4]

Stream System.Net.WebClient.OpenWrite ( Uri  address,
string  method 
)

Opens a stream for writing data to the specified resource, by using the specified method.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
Returns
A T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- An error occurred while opening the stream.

Definition at line 1171 of file WebClient.cs.

◆ OpenWriteAsync() [1/3]

void System.Net.WebClient.OpenWriteAsync ( Uri  address)

Opens a stream for writing data to the specified resource. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the data.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.

Definition at line 2446 of file WebClient.cs.

◆ OpenWriteAsync() [2/3]

void System.Net.WebClient.OpenWriteAsync ( Uri  address,
string  method 
)

Opens a stream for writing data to the specified resource. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.

Definition at line 2456 of file WebClient.cs.

◆ OpenWriteAsync() [3/3]

void System.Net.WebClient.OpenWriteAsync ( Uri  address,
string  method,
object  userToken 
)

Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.

Definition at line 2468 of file WebClient.cs.

◆ OpenWriteTaskAsync() [1/4]

Task<Stream> System.Net.WebClient.OpenWriteTaskAsync ( string  address)

Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the data.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.

Definition at line 3382 of file WebClient.cs.

◆ OpenWriteTaskAsync() [2/4]

Task<Stream> System.Net.WebClient.OpenWriteTaskAsync ( Uri  address)

Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the data.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.

Definition at line 3394 of file WebClient.cs.

◆ OpenWriteTaskAsync() [3/4]

Task<Stream> System.Net.WebClient.OpenWriteTaskAsync ( string  address,
string  method 
)

Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.

Definition at line 3407 of file WebClient.cs.

◆ OpenWriteTaskAsync() [4/4]

Task<Stream> System.Net.WebClient.OpenWriteTaskAsync ( Uri  address,
string  method 
)

Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.IO.Stream used to write data to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.

Definition at line 3420 of file WebClient.cs.

◆ UploadData() [1/4]

byte [] System.Net.WebClient.UploadData ( string  address,
byte []  data 
)

Uploads a data buffer to a resource identified by a URI.

Parameters
addressThe URI of the resource to receive the data.
dataThe data buffer to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null. -or-An error occurred while sending the data.-or- There was no response from the server hosting the resource.

Definition at line 1225 of file WebClient.cs.

◆ UploadData() [2/4]

byte [] System.Net.WebClient.UploadData ( Uri  address,
byte []  data 
)

Uploads a data buffer to a resource identified by a URI.

Parameters
addressThe URI of the resource to receive the data.
dataThe data buffer to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null. -or-An error occurred while sending the data.-or- There was no response from the server hosting the resource.

Definition at line 1241 of file WebClient.cs.

◆ UploadData() [3/4]

byte [] System.Net.WebClient.UploadData ( string  address,
string  method,
byte []  data 
)

Uploads a data buffer to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the data.
methodThe HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- An error occurred while uploading the data.-or- There was no response from the server hosting the resource.

Definition at line 1254 of file WebClient.cs.

◆ UploadData() [4/4]

byte [] System.Net.WebClient.UploadData ( Uri  address,
string  method,
byte []  data 
)

Uploads a data buffer to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the data.
methodThe HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- An error occurred while uploading the data.-or- There was no response from the server hosting the resource.

Definition at line 1271 of file WebClient.cs.

◆ UploadDataAsync() [1/3]

void System.Net.WebClient.UploadDataAsync ( Uri  address,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
dataThe data buffer to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 2957 of file WebClient.cs.

◆ UploadDataAsync() [2/3]

void System.Net.WebClient.UploadDataAsync ( Uri  address,
string  method,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 2969 of file WebClient.cs.

◆ UploadDataAsync() [3/3]

void System.Net.WebClient.UploadDataAsync ( Uri  address,
string  method,
byte []  data,
object  userToken 
)

Uploads a data buffer to a resource identified by a URI, using the specified method and identifying token.

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 2982 of file WebClient.cs.

◆ UploadDataTaskAsync() [1/4]

Task<byte[]> System.Net.WebClient.UploadDataTaskAsync ( string  address,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
dataThe data buffer to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the data buffer was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 3625 of file WebClient.cs.

◆ UploadDataTaskAsync() [2/4]

Task<byte[]> System.Net.WebClient.UploadDataTaskAsync ( Uri  address,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
dataThe data buffer to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the data buffer was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 3638 of file WebClient.cs.

◆ UploadDataTaskAsync() [3/4]

Task<byte[]> System.Net.WebClient.UploadDataTaskAsync ( string  address,
string  method,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the data buffer was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 3652 of file WebClient.cs.

◆ UploadDataTaskAsync() [4/4]

Task<byte[]> System.Net.WebClient.UploadDataTaskAsync ( Uri  address,
string  method,
byte []  data 
)

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

Parameters
addressThe URI of the resource to receive the data.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
dataThe data buffer to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the data buffer was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.

Definition at line 3666 of file WebClient.cs.

◆ UploadFile() [1/4]

byte [] System.Net.WebClient.UploadFile ( string  address,
string  fileName 
)

Uploads the specified local file to a resource with the specified URI.

Parameters
addressThe URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
fileNameThe file to send to the resource. For example, "samplefile.txt".
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 1397 of file WebClient.cs.

◆ UploadFile() [2/4]

byte [] System.Net.WebClient.UploadFile ( Uri  address,
string  fileName 
)

Uploads the specified local file to a resource with the specified URI.

Parameters
addressThe URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.
fileNameThe file to send to the resource. For example, "samplefile.txt".
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 1413 of file WebClient.cs.

◆ UploadFile() [3/4]

byte [] System.Net.WebClient.UploadFile ( string  address,
string  method,
string  fileName 
)

Uploads the specified local file to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the file.
methodThe method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe file to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 1426 of file WebClient.cs.

◆ UploadFile() [4/4]

byte [] System.Net.WebClient.UploadFile ( Uri  address,
string  method,
string  fileName 
)

Uploads the specified local file to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the file.
methodThe method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe file to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 1439 of file WebClient.cs.

◆ UploadFileAsync() [1/3]

void System.Net.WebClient.UploadFileAsync ( Uri  address,
string  fileName 
)

Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the file. 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.
fileNameThe file to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3078 of file WebClient.cs.

◆ UploadFileAsync() [2/3]

void System.Net.WebClient.UploadFileAsync ( Uri  address,
string  method,
string  fileName 
)

Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the file. 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.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe file to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3091 of file WebClient.cs.

◆ UploadFileAsync() [3/3]

void System.Net.WebClient.UploadFileAsync ( Uri  address,
string  method,
string  fileName,
object  userToken 
)

Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.

Parameters
addressThe URI of the resource to receive the file. 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.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe file to send to the resource.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3105 of file WebClient.cs.

◆ UploadFileTaskAsync() [1/4]

Task<byte[]> System.Net.WebClient.UploadFileTaskAsync ( string  address,
string  fileName 
)

Uploads the specified local file to a resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the file. 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.
fileNameThe local file to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the file was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3699 of file WebClient.cs.

◆ UploadFileTaskAsync() [2/4]

Task<byte[]> System.Net.WebClient.UploadFileTaskAsync ( Uri  address,
string  fileName 
)

Uploads the specified local file to a resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the file. 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.
fileNameThe local file to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the file was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3713 of file WebClient.cs.

◆ UploadFileTaskAsync() [3/4]

Task<byte[]> System.Net.WebClient.UploadFileTaskAsync ( string  address,
string  method,
string  fileName 
)

Uploads the specified local file to a resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the file. 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.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe local file to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the file was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3728 of file WebClient.cs.

◆ UploadFileTaskAsync() [4/4]

Task<byte[]> System.Net.WebClient.UploadFileTaskAsync ( Uri  address,
string  method,
string  fileName 
)

Uploads the specified local file to a resource as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the file. 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.
methodThe method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.
fileNameThe local file to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the body of the response received from the resource when the file was uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null. -or-The fileName parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- fileName is null, is F:System.String.Empty, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart.

Definition at line 3743 of file WebClient.cs.

◆ UploadString() [1/4]

string System.Net.WebClient.UploadString ( string  address,
string  data 
)

Uploads the specified string to the specified resource, using the POST method.

Parameters
addressThe 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.
dataThe string to be uploaded.
Returns
A T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 1643 of file WebClient.cs.

◆ UploadString() [2/4]

string System.Net.WebClient.UploadString ( Uri  address,
string  data 
)

Uploads the specified string to the specified resource, using the POST method.

Parameters
addressThe 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.
dataThe string to be uploaded.
Returns
A T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 1658 of file WebClient.cs.

◆ UploadString() [3/4]

string System.Net.WebClient.UploadString ( string  address,
string  method,
string  data 
)

Uploads the specified string to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the string. This URI must identify a resource that can accept a request sent with the method method.
methodThe HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
Returns
A T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.-or- method cannot be used to send content.

Definition at line 1671 of file WebClient.cs.

◆ UploadString() [4/4]

string System.Net.WebClient.UploadString ( Uri  address,
string  method,
string  data 
)

Uploads the specified string to the specified resource, using the specified method.

Parameters
addressThe URI of the resource to receive the string. This URI must identify a resource that can accept a request sent with the method method.
methodThe HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
Returns
A T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.-or- method cannot be used to send content.

Definition at line 1688 of file WebClient.cs.

◆ UploadStringAsync() [1/3]

void System.Net.WebClient.UploadStringAsync ( Uri  address,
string  data 
)

Uploads the specified string to the specified resource. This method does not block the calling thread.

Parameters
addressThe 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.
dataThe string to be uploaded.
Exceptions
T:System.ArgumentNullExceptiondata is null.
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 2840 of file WebClient.cs.

◆ UploadStringAsync() [2/3]

void System.Net.WebClient.UploadStringAsync ( Uri  address,
string  method,
string  data 
)

Uploads the specified string to the specified resource. This method does not block the calling thread.

Parameters
addressThe 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.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.

Definition at line 2853 of file WebClient.cs.

◆ UploadStringAsync() [3/3]

void System.Net.WebClient.UploadStringAsync ( Uri  address,
string  method,
string  data,
object  userToken 
)

Uploads the specified string to the specified resource. This method does not block the calling thread.

Parameters
addressThe 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.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.

Definition at line 2867 of file WebClient.cs.

◆ UploadStringTaskAsync() [1/4]

Task<string> System.Net.WebClient.UploadStringTaskAsync ( string  address,
string  data 
)

Uploads the specified string to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe 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.
dataThe string to be uploaded.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptiondata is null.
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 3454 of file WebClient.cs.

◆ UploadStringTaskAsync() [2/4]

Task<string> System.Net.WebClient.UploadStringTaskAsync ( Uri  address,
string  data 
)

Uploads the specified string to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe 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.
dataThe string to be uploaded.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptiondata is null.
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 3469 of file WebClient.cs.

◆ UploadStringTaskAsync() [3/4]

Task<string> System.Net.WebClient.UploadStringTaskAsync ( string  address,
string  method,
string  data 
)

Uploads the specified string to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe 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.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptiondata is null.
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.

Definition at line 3486 of file WebClient.cs.

◆ UploadStringTaskAsync() [4/4]

Task<string> System.Net.WebClient.UploadStringTaskAsync ( Uri  address,
string  method,
string  data 
)

Uploads the specified string to the specified resource as an asynchronous operation using a task object.

Parameters
addressThe 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.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe string to be uploaded.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.String containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptiondata is null.
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.

Definition at line 3503 of file WebClient.cs.

◆ UploadValues() [1/4]

byte [] System.Net.WebClient.UploadValues ( string  address,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI.

Parameters
addressThe URI of the resource to receive the collection.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded".

Definition at line 1538 of file WebClient.cs.

◆ UploadValues() [2/4]

byte [] System.Net.WebClient.UploadValues ( Uri  address,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI.

Parameters
addressThe URI of the resource to receive the collection.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded".

Definition at line 1554 of file WebClient.cs.

◆ UploadValues() [3/4]

byte [] System.Net.WebClient.UploadValues ( string  address,
string  method,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.

Parameters
addressThe URI of the resource to receive the collection.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header value is not null and is not application/x-www-form-urlencoded.

Definition at line 1567 of file WebClient.cs.

◆ UploadValues() [4/4]

byte [] System.Net.WebClient.UploadValues ( Uri  address,
string  method,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.

Parameters
addressThe URI of the resource to receive the collection.
methodThe HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
A T:System.Byte array containing the body of the response from the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- data is null.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header value is not null and is not application/x-www-form-urlencoded.

Definition at line 1584 of file WebClient.cs.

◆ UploadValuesAsync() [1/3]

void System.Net.WebClient.UploadValuesAsync ( Uri  address,
NameValueCollection  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.

Parameters
addressThe URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the default method. See remarks.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.

Definition at line 3201 of file WebClient.cs.

◆ UploadValuesAsync() [2/3]

void System.Net.WebClient.UploadValuesAsync ( Uri  address,
string  method,
NameValueCollection  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.

Parameters
addressThe URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the method method.
methodThe method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.-or- method cannot be used to send content.

Definition at line 3214 of file WebClient.cs.

◆ UploadValuesAsync() [3/3]

void System.Net.WebClient.UploadValuesAsync ( Uri  address,
string  method,
NameValueCollection  data,
object  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.

Parameters
addressThe URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the method method.
methodThe HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
userTokenA user-defined object that is passed to the method invoked when the asynchronous operation completes.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress and address is invalid.-or- There was no response from the server hosting the resource.-or- method cannot be used to send content.

Definition at line 3228 of file WebClient.cs.

◆ UploadValuesTaskAsync() [1/4]

Task<byte[]> System.Net.WebClient.UploadValuesTaskAsync ( string  address,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the collection.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded".

Definition at line 3775 of file WebClient.cs.

◆ UploadValuesTaskAsync() [2/4]

Task<byte[]> System.Net.WebClient.UploadValuesTaskAsync ( string  address,
string  method,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the collection.
methodThe HTTP method used to send the collection to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded".

Definition at line 3790 of file WebClient.cs.

◆ UploadValuesTaskAsync() [3/4]

Task<byte[]> System.Net.WebClient.UploadValuesTaskAsync ( Uri  address,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the collection.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header value is not null and is not application/x-www-form-urlencoded.

Definition at line 3803 of file WebClient.cs.

◆ UploadValuesTaskAsync() [4/4]

Task<byte[]> System.Net.WebClient.UploadValuesTaskAsync ( Uri  address,
string  method,
NameValueCollection  data 
)

Uploads the specified name/value collection to the resource identified by the specified URI as an asynchronous operation using a task object.

Parameters
addressThe URI of the resource to receive the collection.
methodThe HTTP method used to send the collection to the resource. If null, the default is POST for http and STOR for ftp.
dataThe T:System.Collections.Specialized.NameValueCollection to send to the resource.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns a T:System.Byte array containing the response sent by the server.
Exceptions
T:System.ArgumentNullExceptionThe address parameter is null.-or-The data parameter is null.
T:System.Net.WebExceptionThe URI formed by combining P:System.Net.WebClient.BaseAddress, and address is invalid.-or- method cannot be used to send content.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded".

Definition at line 3818 of file WebClient.cs.

Member Data Documentation

◆ IsBusy

bool System.Net.WebClient.IsBusy => m_AsyncOp != null

Gets whether a Web request is in progress.

Returns
true if the Web request is still in progress; otherwise false.

Definition at line 755 of file WebClient.cs.

Property Documentation

◆ AllowReadStreamBuffering

bool System.Net.WebClient.AllowReadStreamBuffering
getset

Gets or sets a value that indicates whether to buffer the data read from the Internet resource for a T:System.Net.WebClient instance.

Returns
Returns T:System.Boolean. true to enable buffering of the data received from the Internet resource; false to disable buffering. The default is true.

Definition at line 564 of file WebClient.cs.

◆ AllowWriteStreamBuffering

bool System.Net.WebClient.AllowWriteStreamBuffering
getset

Gets or sets a value that indicates whether to buffer the data written to the Internet resource for a T:System.Net.WebClient instance.

Returns
Returns T:System.Boolean. true to enable buffering of the data written to the Internet resource; false to disable buffering. The default is true.

Definition at line 575 of file WebClient.cs.

◆ BaseAddress

string System.Net.WebClient.BaseAddress
getset

Gets or sets the base URI for requests made by a T:System.Net.WebClient.

Returns
A T:System.String containing the base URI for requests made by a T:System.Net.WebClient or F:System.String.Empty if no base address has been specified.
Exceptions
T:System.ArgumentExceptionP:System.Net.WebClient.BaseAddress is set to an invalid URI. The inner exception may contain information that will help you locate the error.

Definition at line 603 of file WebClient.cs.

◆ CachePolicy

RequestCachePolicy System.Net.WebClient.CachePolicy
getset

Gets or sets the application's cache policy for any resources obtained by this WebClient instance using T:System.Net.WebRequest objects.

Returns
A T:System.Net.Cache.RequestCachePolicy object that represents the application's caching requirements.

Definition at line 741 of file WebClient.cs.

◆ Credentials

ICredentials System.Net.WebClient.Credentials
getset

Gets or sets the network credentials that are sent to the host and used to authenticate the request.

Returns
An T:System.Net.ICredentials containing the authentication credentials for the request. The default is null.

Definition at line 635 of file WebClient.cs.

◆ Encoding

Encoding System.Net.WebClient.Encoding
getset

Gets and sets the T:System.Text.Encoding used to upload and download strings.

Returns
A T:System.Text.Encoding that is used to encode strings. The default value of this property is the encoding returned by P:System.Text.Encoding.Default.

Definition at line 583 of file WebClient.cs.

◆ Headers

WebHeaderCollection System.Net.WebClient.Headers
getset

Gets or sets a collection of header name/value pairs associated with the request.

Returns
A T:System.Net.WebHeaderCollection containing header name/value pairs associated with this request.

Definition at line 668 of file WebClient.cs.

◆ Proxy

IWebProxy System.Net.WebClient.Proxy
getset

Gets or sets the proxy used by this T:System.Net.WebClient object.

Returns
An T:System.Net.IWebProxy instance used to send requests.
Exceptions
T:System.ArgumentNullExceptionP:System.Net.WebClient.Proxy is set to null.

Definition at line 720 of file WebClient.cs.

◆ QueryString

NameValueCollection System.Net.WebClient.QueryString
getset

Gets or sets a collection of query name/value pairs associated with the request.

Returns
A T:System.Collections.Specialized.NameValueCollection that contains query name/value pairs associated with the request. If no pairs are associated with the request, the value is an empty T:System.Collections.Specialized.NameValueCollection.

Definition at line 686 of file WebClient.cs.

◆ ResponseHeaders

WebHeaderCollection System.Net.WebClient.ResponseHeaders
get

Gets a collection of header name/value pairs associated with the response.

Returns
A T:System.Net.WebHeaderCollection containing header name/value pairs associated with the response, or null if no response has been received.

Definition at line 704 of file WebClient.cs.

◆ UseDefaultCredentials

bool? System.Net.WebClient.UseDefaultCredentials
getset

Gets or sets a T:System.Boolean value that controls whether the P:System.Net.CredentialCache.DefaultCredentials are sent with requests.

Returns
true if the default credentials are used; otherwise false. The default value is false.

Definition at line 650 of file WebClient.cs.

◆ WriteStreamClosed

WriteStreamClosedEventHandler System.Net.WebClient.WriteStreamClosed
addremove

Occurs when an asynchronous operation to write data to a resource using a write stream is closed.

Definition at line 761 of file WebClient.cs.

Event Documentation

◆ DownloadDataCompleted

DownloadDataCompletedEventHandler System.Net.WebClient.DownloadDataCompleted

Occurs when an asynchronous data download operation completes.

Definition at line 780 of file WebClient.cs.

◆ DownloadFileCompleted

AsyncCompletedEventHandler System.Net.WebClient.DownloadFileCompleted

Occurs when an asynchronous file download operation completes.

Definition at line 783 of file WebClient.cs.

◆ DownloadProgressChanged

DownloadProgressChangedEventHandler System.Net.WebClient.DownloadProgressChanged

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

Definition at line 798 of file WebClient.cs.

◆ DownloadStringCompleted

DownloadStringCompletedEventHandler System.Net.WebClient.DownloadStringCompleted

Occurs when an asynchronous resource-download operation completes.

Definition at line 777 of file WebClient.cs.

◆ OpenReadCompleted

OpenReadCompletedEventHandler System.Net.WebClient.OpenReadCompleted

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

Definition at line 771 of file WebClient.cs.

◆ OpenWriteCompleted

OpenWriteCompletedEventHandler System.Net.WebClient.OpenWriteCompleted

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

Definition at line 774 of file WebClient.cs.

◆ UploadDataCompleted

UploadDataCompletedEventHandler System.Net.WebClient.UploadDataCompleted

Occurs when an asynchronous data-upload operation completes.

Definition at line 789 of file WebClient.cs.

◆ UploadFileCompleted

UploadFileCompletedEventHandler System.Net.WebClient.UploadFileCompleted

Occurs when an asynchronous file-upload operation completes.

Definition at line 792 of file WebClient.cs.

◆ UploadProgressChanged

UploadProgressChangedEventHandler System.Net.WebClient.UploadProgressChanged

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

Definition at line 801 of file WebClient.cs.

◆ UploadStringCompleted

UploadStringCompletedEventHandler System.Net.WebClient.UploadStringCompleted

Occurs when an asynchronous string-upload operation completes.

Definition at line 786 of file WebClient.cs.

◆ UploadValuesCompleted

UploadValuesCompletedEventHandler System.Net.WebClient.UploadValuesCompleted

Occurs when an asynchronous upload of a name/value collection completes.

Definition at line 795 of file WebClient.cs.


The documentation for this class was generated from the following file: