WebClient WebClient WebClient WebClient Class

Definition

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

public ref class WebClient : System::ComponentModel::Component
[System.Runtime.InteropServices.ComVisible(true)]
public class WebClient : System.ComponentModel.Component
type WebClient = class
    inherit Component
Public Class WebClient
Inherits Component
Inheritance
Attributes

Examples

The following code example takes the URI of a resource, retrieves it, and displays the response.

#using <System.dll>

using namespace System;
using namespace System::Net;
using namespace System::IO;
int main()
{
   array<String^>^args = Environment::GetCommandLineArgs();
   if ( args == nullptr || args->Length == 1 )
   {
      throw gcnew ApplicationException( "Specify the URI of the resource to retrieve." );
   }

   WebClient^ client = gcnew WebClient;
   
   // Add a user agent header in case the 
   // requested URI contains a query.
   client->Headers->Add( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" );
   Stream^ data = client->OpenRead( args[ 1 ] );
   StreamReader^ reader = gcnew StreamReader( data );
   String^ s = reader->ReadToEnd();
   Console::WriteLine( s );
   data->Close();
   reader->Close();
}

using System;
using System.Net;
using System.IO;

public class Test
{
    public static void Main (string[] args)
    {
        if (args == null || args.Length == 0)
        {
            throw new ApplicationException ("Specify the URI of the resource to retrieve.");
        }
        WebClient client = new WebClient ();

        // Add a user agent header in case the 
        // requested URI contains a query.

        client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

        Stream data = client.OpenRead (args[0]);
        StreamReader reader = new StreamReader (data);
        string s = reader.ReadToEnd ();
        Console.WriteLine (s);
        data.Close ();
        reader.Close ();
    }
}
Imports System
Imports System.Net
Imports System.IO



Public Class Test
    
    Public Shared Sub Main(args() As String)
        If args Is Nothing OrElse args.Length = 0 Then
            Throw New ApplicationException("Specify the URI of the resource to retrieve.")
        End If
        Dim client As New WebClient()
        
        ' Add a user agent header in case the 
        ' requested URI contains a query.
        client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
        
        Dim data As Stream = client.OpenRead(args(0))
        Dim reader As New StreamReader(data)
        Dim s As String = reader.ReadToEnd()
        Console.WriteLine(s)
        data.Close()
        reader.Close()
    End Sub 'Main
End Class 'Test

Remarks

Important

We don't recommend that you use the WebClient class for new development. Instead, use the System.Net.Http.HttpClient class.

The WebClient class provides common methods for sending data to or receiving data from any local, intranet, or Internet resource identified by a URI.

The WebClient class uses the WebRequest class to provide access to resources. WebClient instances can access data with any WebRequest descendant registered with the WebRequest.RegisterPrefix method.

Note

By default, the .NET Framework supports URIs that begin with http:, https:, ftp:, and file: scheme identifiers.

The following table describes WebClient methods for uploading data to a resource.

Method Description
OpenWrite Retrieves a Stream used to send data to the resource.
OpenWriteAsync Retrieves a Stream used to send data to the resource, without blocking the calling thread.
UploadData Sends a byte array to the resource and returns a Byte array containing any response.
UploadDataAsync Sends a Byte array to the resource, without blocking the calling thread.
UploadFile Sends a local file to the resource and returns a Byte array containing any response.
UploadFileAsync Sends a local file to the resource, without blocking the calling thread.
UploadValues Sends a NameValueCollection to the resource and returns a Byte array containing any response.
UploadValuesAsync Sends a NameValueCollection to the resource and returns a Byte array containing any response, without blocking the calling thread.
UploadString Sends a String to the resource, without blocking the calling thread.
UploadStringAsync Sends a String to the resource, without blocking the calling thread.

The following table describes WebClient methods for downloading data from a resource.

Method Description
OpenRead Returns the data from a resource as a Stream.
OpenReadAsync Returns the data from a resource, without blocking the calling thread.
DownloadData Downloads data from a resource and returns a Byte array.
DownloadDataAsync Downloads data from a resource and returns a Byte array, without blocking the calling thread.
DownloadFile Downloads data from a resource to a local file.
DownloadFileAsync Downloads data from a resource to a local file, without blocking the calling thread.
DownloadString Downloads a String from a resource and returns a String.
DownloadStringAsync Downloads a String from a resource, without blocking the calling thread.

You can use the CancelAsync method to cancel asynchronous operations that have not completed.

A WebClient instance does not send optional HTTP headers by default. If your request requires an optional header, you must add the header to the Headers collection. For example, to retain queries in the response, you must add a user-agent header. Also, servers may return 500 (Internal Server Error) if the user agent header is missing.

AllowAutoRedirect is set to true in WebClient instances.

Notes to Inheritors

Derived classes should call the base class implementation of WebClient to ensure the derived class works as expected.

Constructors

WebClient() WebClient() WebClient() WebClient()

Initializes a new instance of the WebClient class.

Properties

AllowReadStreamBuffering AllowReadStreamBuffering AllowReadStreamBuffering AllowReadStreamBuffering

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

AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering

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

BaseAddress BaseAddress BaseAddress BaseAddress

Gets or sets the base URI for requests made by a WebClient.

CachePolicy CachePolicy CachePolicy CachePolicy

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

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
Container Container Container Container

Gets the IContainer that contains the Component.

(Inherited from Component)
Credentials Credentials Credentials Credentials

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

DesignMode DesignMode DesignMode DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Encoding Encoding Encoding Encoding

Gets and sets the Encoding used to upload and download strings.

Events Events Events Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
Headers Headers Headers Headers

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

IsBusy IsBusy IsBusy IsBusy

Gets whether a Web request is in progress.

Proxy Proxy Proxy Proxy

Gets or sets the proxy used by this WebClient object.

QueryString QueryString QueryString QueryString

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

ResponseHeaders ResponseHeaders ResponseHeaders ResponseHeaders

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

Site Site Site Site

Gets or sets the ISite of the Component.

(Inherited from Component)
UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials

Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.

Methods

CancelAsync() CancelAsync() CancelAsync() CancelAsync()

Cancels a pending asynchronous operation.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(Inherited from Component)
DownloadData(String) DownloadData(String) DownloadData(String) DownloadData(String)

Downloads the resource as a Byte array from the URI specified.

DownloadData(Uri) DownloadData(Uri) DownloadData(Uri) DownloadData(Uri)

Downloads the resource as a Byte array from the URI specified.

DownloadDataAsync(Uri) DownloadDataAsync(Uri) DownloadDataAsync(Uri) DownloadDataAsync(Uri)

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

DownloadDataAsync(Uri, Object) DownloadDataAsync(Uri, Object) DownloadDataAsync(Uri, Object) DownloadDataAsync(Uri, Object)

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

DownloadDataTaskAsync(String) DownloadDataTaskAsync(String) DownloadDataTaskAsync(String) DownloadDataTaskAsync(String)

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

DownloadDataTaskAsync(Uri) DownloadDataTaskAsync(Uri) DownloadDataTaskAsync(Uri) DownloadDataTaskAsync(Uri)

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

DownloadFile(String, String) DownloadFile(String, String) DownloadFile(String, String) DownloadFile(String, String)

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

DownloadFile(Uri, String) DownloadFile(Uri, String) DownloadFile(Uri, String) DownloadFile(Uri, String)

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

DownloadFileAsync(Uri, String) DownloadFileAsync(Uri, String) DownloadFileAsync(Uri, String) DownloadFileAsync(Uri, String)

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

DownloadFileAsync(Uri, String, Object) DownloadFileAsync(Uri, String, Object) DownloadFileAsync(Uri, String, Object) DownloadFileAsync(Uri, String, Object)

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

DownloadFileTaskAsync(String, String) DownloadFileTaskAsync(String, String) DownloadFileTaskAsync(String, String) DownloadFileTaskAsync(String, String)

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

DownloadFileTaskAsync(Uri, String) DownloadFileTaskAsync(Uri, String) DownloadFileTaskAsync(Uri, String) DownloadFileTaskAsync(Uri, String)

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

DownloadString(String) DownloadString(String) DownloadString(String) DownloadString(String)

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

DownloadString(Uri) DownloadString(Uri) DownloadString(Uri) DownloadString(Uri)

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

DownloadStringAsync(Uri) DownloadStringAsync(Uri) DownloadStringAsync(Uri) DownloadStringAsync(Uri)

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

DownloadStringAsync(Uri, Object) DownloadStringAsync(Uri, Object) DownloadStringAsync(Uri, Object) DownloadStringAsync(Uri, Object)

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

DownloadStringTaskAsync(String) DownloadStringTaskAsync(String) DownloadStringTaskAsync(String) DownloadStringTaskAsync(String)

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

DownloadStringTaskAsync(Uri) DownloadStringTaskAsync(Uri) DownloadStringTaskAsync(Uri) DownloadStringTaskAsync(Uri)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetWebRequest(Uri) GetWebRequest(Uri) GetWebRequest(Uri) GetWebRequest(Uri)

Returns a WebRequest object for the specified resource.

GetWebResponse(WebRequest) GetWebResponse(WebRequest) GetWebResponse(WebRequest) GetWebResponse(WebRequest)

Returns the WebResponse for the specified WebRequest.

GetWebResponse(WebRequest, IAsyncResult) GetWebResponse(WebRequest, IAsyncResult) GetWebResponse(WebRequest, IAsyncResult) GetWebResponse(WebRequest, IAsyncResult)

Returns the WebResponse for the specified WebRequest using the specified IAsyncResult.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OnDownloadDataCompleted(DownloadDataCompletedEventArgs) OnDownloadDataCompleted(DownloadDataCompletedEventArgs) OnDownloadDataCompleted(DownloadDataCompletedEventArgs) OnDownloadDataCompleted(DownloadDataCompletedEventArgs)

Raises the DownloadDataCompleted event.

OnDownloadFileCompleted(AsyncCompletedEventArgs) OnDownloadFileCompleted(AsyncCompletedEventArgs) OnDownloadFileCompleted(AsyncCompletedEventArgs) OnDownloadFileCompleted(AsyncCompletedEventArgs)

Raises the DownloadFileCompleted event.

OnDownloadProgressChanged(DownloadProgressChangedEventArgs) OnDownloadProgressChanged(DownloadProgressChangedEventArgs) OnDownloadProgressChanged(DownloadProgressChangedEventArgs) OnDownloadProgressChanged(DownloadProgressChangedEventArgs)

Raises the DownloadProgressChanged event.

OnDownloadStringCompleted(DownloadStringCompletedEventArgs) OnDownloadStringCompleted(DownloadStringCompletedEventArgs) OnDownloadStringCompleted(DownloadStringCompletedEventArgs) OnDownloadStringCompleted(DownloadStringCompletedEventArgs)

Raises the DownloadStringCompleted event.

OnOpenReadCompleted(OpenReadCompletedEventArgs) OnOpenReadCompleted(OpenReadCompletedEventArgs) OnOpenReadCompleted(OpenReadCompletedEventArgs) OnOpenReadCompleted(OpenReadCompletedEventArgs)

Raises the OpenReadCompleted event.

OnOpenWriteCompleted(OpenWriteCompletedEventArgs) OnOpenWriteCompleted(OpenWriteCompletedEventArgs) OnOpenWriteCompleted(OpenWriteCompletedEventArgs) OnOpenWriteCompleted(OpenWriteCompletedEventArgs)

Raises the OpenWriteCompleted event.

OnUploadDataCompleted(UploadDataCompletedEventArgs) OnUploadDataCompleted(UploadDataCompletedEventArgs) OnUploadDataCompleted(UploadDataCompletedEventArgs) OnUploadDataCompleted(UploadDataCompletedEventArgs)

Raises the UploadDataCompleted event.

OnUploadFileCompleted(UploadFileCompletedEventArgs) OnUploadFileCompleted(UploadFileCompletedEventArgs) OnUploadFileCompleted(UploadFileCompletedEventArgs) OnUploadFileCompleted(UploadFileCompletedEventArgs)

Raises the UploadFileCompleted event.

OnUploadProgressChanged(UploadProgressChangedEventArgs) OnUploadProgressChanged(UploadProgressChangedEventArgs) OnUploadProgressChanged(UploadProgressChangedEventArgs) OnUploadProgressChanged(UploadProgressChangedEventArgs)

Raises the UploadProgressChanged event.

OnUploadStringCompleted(UploadStringCompletedEventArgs) OnUploadStringCompleted(UploadStringCompletedEventArgs) OnUploadStringCompleted(UploadStringCompletedEventArgs) OnUploadStringCompleted(UploadStringCompletedEventArgs)

Raises the UploadStringCompleted event.

OnUploadValuesCompleted(UploadValuesCompletedEventArgs) OnUploadValuesCompleted(UploadValuesCompletedEventArgs) OnUploadValuesCompleted(UploadValuesCompletedEventArgs) OnUploadValuesCompleted(UploadValuesCompletedEventArgs)

Raises the UploadValuesCompleted event.

OnWriteStreamClosed(WriteStreamClosedEventArgs) OnWriteStreamClosed(WriteStreamClosedEventArgs) OnWriteStreamClosed(WriteStreamClosedEventArgs) OnWriteStreamClosed(WriteStreamClosedEventArgs)

Raises the WriteStreamClosed event.

OpenRead(String) OpenRead(String) OpenRead(String) OpenRead(String)

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

OpenRead(Uri) OpenRead(Uri) OpenRead(Uri) OpenRead(Uri)

Opens a readable stream for the data downloaded from a resource with the URI specified as a Uri

OpenReadAsync(Uri) OpenReadAsync(Uri) OpenReadAsync(Uri) OpenReadAsync(Uri)

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

OpenReadAsync(Uri, Object) OpenReadAsync(Uri, Object) OpenReadAsync(Uri, Object) OpenReadAsync(Uri, Object)

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

OpenReadTaskAsync(String) OpenReadTaskAsync(String) OpenReadTaskAsync(String) OpenReadTaskAsync(String)

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

OpenReadTaskAsync(Uri) OpenReadTaskAsync(Uri) OpenReadTaskAsync(Uri) OpenReadTaskAsync(Uri)

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

OpenWrite(String) OpenWrite(String) OpenWrite(String) OpenWrite(String)

Opens a stream for writing data to the specified resource.

OpenWrite(String, String) OpenWrite(String, String) OpenWrite(String, String) OpenWrite(String, String)

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

OpenWrite(Uri) OpenWrite(Uri) OpenWrite(Uri) OpenWrite(Uri)

Opens a stream for writing data to the specified resource.

OpenWrite(Uri, String) OpenWrite(Uri, String) OpenWrite(Uri, String) OpenWrite(Uri, String)

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

OpenWriteAsync(Uri) OpenWriteAsync(Uri) OpenWriteAsync(Uri) OpenWriteAsync(Uri)

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

OpenWriteAsync(Uri, String) OpenWriteAsync(Uri, String) OpenWriteAsync(Uri, String) OpenWriteAsync(Uri, String)

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

OpenWriteAsync(Uri, String, Object) OpenWriteAsync(Uri, String, Object) OpenWriteAsync(Uri, String, Object) OpenWriteAsync(Uri, String, Object)

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

OpenWriteTaskAsync(String) OpenWriteTaskAsync(String) OpenWriteTaskAsync(String) OpenWriteTaskAsync(String)

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

OpenWriteTaskAsync(String, String) OpenWriteTaskAsync(String, String) OpenWriteTaskAsync(String, String) OpenWriteTaskAsync(String, String)

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

OpenWriteTaskAsync(Uri) OpenWriteTaskAsync(Uri) OpenWriteTaskAsync(Uri) OpenWriteTaskAsync(Uri)

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

OpenWriteTaskAsync(Uri, String) OpenWriteTaskAsync(Uri, String) OpenWriteTaskAsync(Uri, String) OpenWriteTaskAsync(Uri, String)

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

ToString() ToString() ToString() ToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.

(Inherited from Component)
UploadData(String, Byte[]) UploadData(String, Byte[]) UploadData(String, Byte[]) UploadData(String, Byte[])

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

UploadData(String, String, Byte[]) UploadData(String, String, Byte[]) UploadData(String, String, Byte[]) UploadData(String, String, Byte[])

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

UploadData(Uri, Byte[]) UploadData(Uri, Byte[]) UploadData(Uri, Byte[]) UploadData(Uri, Byte[])

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

UploadData(Uri, String, Byte[]) UploadData(Uri, String, Byte[]) UploadData(Uri, String, Byte[]) UploadData(Uri, String, Byte[])

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

UploadDataAsync(Uri, Byte[]) UploadDataAsync(Uri, Byte[]) UploadDataAsync(Uri, Byte[]) UploadDataAsync(Uri, Byte[])

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

UploadDataAsync(Uri, String, Byte[]) UploadDataAsync(Uri, String, Byte[]) UploadDataAsync(Uri, String, Byte[]) UploadDataAsync(Uri, String, Byte[])

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

UploadDataAsync(Uri, String, Byte[], Object) UploadDataAsync(Uri, String, Byte[], Object) UploadDataAsync(Uri, String, Byte[], Object) UploadDataAsync(Uri, String, Byte[], Object)

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

UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[]) UploadDataTaskAsync(String, Byte[])

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

UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[]) UploadDataTaskAsync(String, String, Byte[])

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

UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[]) UploadDataTaskAsync(Uri, Byte[])

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

UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[]) UploadDataTaskAsync(Uri, String, Byte[])

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

UploadFile(String, String) UploadFile(String, String) UploadFile(String, String) UploadFile(String, String)

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

UploadFile(String, String, String) UploadFile(String, String, String) UploadFile(String, String, String) UploadFile(String, String, String)

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

UploadFile(Uri, String) UploadFile(Uri, String) UploadFile(Uri, String) UploadFile(Uri, String)

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

UploadFile(Uri, String, String) UploadFile(Uri, String, String) UploadFile(Uri, String, String) UploadFile(Uri, String, String)

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

UploadFileAsync(Uri, String) UploadFileAsync(Uri, String) UploadFileAsync(Uri, String) UploadFileAsync(Uri, String)

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

UploadFileAsync(Uri, String, String) UploadFileAsync(Uri, String, String) UploadFileAsync(Uri, String, String) UploadFileAsync(Uri, String, String)

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

UploadFileAsync(Uri, String, String, Object) UploadFileAsync(Uri, String, String, Object) UploadFileAsync(Uri, String, String, Object) UploadFileAsync(Uri, String, String, Object)

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

UploadFileTaskAsync(String, String) UploadFileTaskAsync(String, String) UploadFileTaskAsync(String, String) UploadFileTaskAsync(String, String)

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

UploadFileTaskAsync(String, String, String) UploadFileTaskAsync(String, String, String) UploadFileTaskAsync(String, String, String) UploadFileTaskAsync(String, String, String)

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

UploadFileTaskAsync(Uri, String) UploadFileTaskAsync(Uri, String) UploadFileTaskAsync(Uri, String) UploadFileTaskAsync(Uri, String)

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

UploadFileTaskAsync(Uri, String, String) UploadFileTaskAsync(Uri, String, String) UploadFileTaskAsync(Uri, String, String) UploadFileTaskAsync(Uri, String, String)

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

UploadString(String, String) UploadString(String, String) UploadString(String, String) UploadString(String, String)

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

UploadString(String, String, String) UploadString(String, String, String) UploadString(String, String, String) UploadString(String, String, String)

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

UploadString(Uri, String) UploadString(Uri, String) UploadString(Uri, String) UploadString(Uri, String)

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

UploadString(Uri, String, String) UploadString(Uri, String, String) UploadString(Uri, String, String) UploadString(Uri, String, String)

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

UploadStringAsync(Uri, String) UploadStringAsync(Uri, String) UploadStringAsync(Uri, String) UploadStringAsync(Uri, String)

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

UploadStringAsync(Uri, String, String) UploadStringAsync(Uri, String, String) UploadStringAsync(Uri, String, String) UploadStringAsync(Uri, String, String)

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

UploadStringAsync(Uri, String, String, Object) UploadStringAsync(Uri, String, String, Object) UploadStringAsync(Uri, String, String, Object) UploadStringAsync(Uri, String, String, Object)

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

UploadStringTaskAsync(String, String) UploadStringTaskAsync(String, String) UploadStringTaskAsync(String, String) UploadStringTaskAsync(String, String)

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

UploadStringTaskAsync(String, String, String) UploadStringTaskAsync(String, String, String) UploadStringTaskAsync(String, String, String) UploadStringTaskAsync(String, String, String)

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

UploadStringTaskAsync(Uri, String) UploadStringTaskAsync(Uri, String) UploadStringTaskAsync(Uri, String) UploadStringTaskAsync(Uri, String)

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

UploadStringTaskAsync(Uri, String, String) UploadStringTaskAsync(Uri, String, String) UploadStringTaskAsync(Uri, String, String) UploadStringTaskAsync(Uri, String, String)

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

UploadValues(String, NameValueCollection) UploadValues(String, NameValueCollection) UploadValues(String, NameValueCollection) UploadValues(String, NameValueCollection)

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

UploadValues(String, String, NameValueCollection) UploadValues(String, String, NameValueCollection) UploadValues(String, String, NameValueCollection) UploadValues(String, String, NameValueCollection)

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

UploadValues(Uri, NameValueCollection) UploadValues(Uri, NameValueCollection) UploadValues(Uri, NameValueCollection) UploadValues(Uri, NameValueCollection)

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

UploadValues(Uri, String, NameValueCollection) UploadValues(Uri, String, NameValueCollection) UploadValues(Uri, String, NameValueCollection) UploadValues(Uri, String, NameValueCollection)

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

UploadValuesAsync(Uri, NameValueCollection) UploadValuesAsync(Uri, NameValueCollection) UploadValuesAsync(Uri, NameValueCollection) UploadValuesAsync(Uri, NameValueCollection)

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

UploadValuesAsync(Uri, String, NameValueCollection) UploadValuesAsync(Uri, String, NameValueCollection) UploadValuesAsync(Uri, String, NameValueCollection) UploadValuesAsync(Uri, String, NameValueCollection)

Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread.

UploadValuesAsync(Uri, String, NameValueCollection, Object) UploadValuesAsync(Uri, String, NameValueCollection, Object) UploadValuesAsync(Uri, String, NameValueCollection, Object) UploadValuesAsync(Uri, String, NameValueCollection, Object)

Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread, and allows the caller to pass an object to the method that is invoked when the operation completes.

UploadValuesTaskAsync(String, NameValueCollection) UploadValuesTaskAsync(String, NameValueCollection) UploadValuesTaskAsync(String, NameValueCollection) UploadValuesTaskAsync(String, NameValueCollection)

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

UploadValuesTaskAsync(String, String, NameValueCollection) UploadValuesTaskAsync(String, String, NameValueCollection) UploadValuesTaskAsync(String, String, NameValueCollection) UploadValuesTaskAsync(String, String, NameValueCollection)

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

UploadValuesTaskAsync(Uri, NameValueCollection) UploadValuesTaskAsync(Uri, NameValueCollection) UploadValuesTaskAsync(Uri, NameValueCollection) UploadValuesTaskAsync(Uri, NameValueCollection)

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

UploadValuesTaskAsync(Uri, String, NameValueCollection) UploadValuesTaskAsync(Uri, String, NameValueCollection) UploadValuesTaskAsync(Uri, String, NameValueCollection) UploadValuesTaskAsync(Uri, String, NameValueCollection)

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

Events

Disposed Disposed Disposed Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)
DownloadDataCompleted DownloadDataCompleted DownloadDataCompleted DownloadDataCompleted

Occurs when an asynchronous data download operation completes.

DownloadFileCompleted DownloadFileCompleted DownloadFileCompleted DownloadFileCompleted

Occurs when an asynchronous file download operation completes.

DownloadProgressChanged DownloadProgressChanged DownloadProgressChanged DownloadProgressChanged

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

DownloadStringCompleted DownloadStringCompleted DownloadStringCompleted DownloadStringCompleted

Occurs when an asynchronous resource-download operation completes.

OpenReadCompleted OpenReadCompleted OpenReadCompleted OpenReadCompleted

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

OpenWriteCompleted OpenWriteCompleted OpenWriteCompleted OpenWriteCompleted

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

UploadDataCompleted UploadDataCompleted UploadDataCompleted UploadDataCompleted

Occurs when an asynchronous data-upload operation completes.

UploadFileCompleted UploadFileCompleted UploadFileCompleted UploadFileCompleted

Occurs when an asynchronous file-upload operation completes.

UploadProgressChanged UploadProgressChanged UploadProgressChanged UploadProgressChanged

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

UploadStringCompleted UploadStringCompleted UploadStringCompleted UploadStringCompleted

Occurs when an asynchronous string-upload operation completes.

UploadValuesCompleted UploadValuesCompleted UploadValuesCompleted UploadValuesCompleted

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

WriteStreamClosed WriteStreamClosed WriteStreamClosed WriteStreamClosed

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

Security

WebPermission
to access the requested URI or any URI that the request is redirected to. Associated enumeration: Connect.

Applies to

See Also