DevWebClient Class

A extended WebClient component, that provides common methods for sending data to and receiving data from a resource identified by a URI, with additional support for cookies and requests timeout.

Definition

Namespace: DevCase.Core.Networking.Common
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[ComVisibleAttribute(true)]
public class DevWebClient : WebClient
Inheritance
Object    MarshalByRefObject    Component    WebClient    DevWebClient

Remarks

Original idea taken from: http://www.codingvision.net/tips-and-tricks/c-webclient-with-cookies

Example

This is a code example that demonstrates how to login to a website.
C#
No code example is currently available or this language may not be supported.

Constructors

DevWebClient Initializes a new instance of the DevWebClient class.

Properties

BaseAddress Gets or sets the base URI for requests made by a WebClient.
(Inherited from WebClient)
CachePolicy Gets or sets the application's cache policy for any resources obtained by this WebClient instance using WebRequest objects.
(Inherited from WebClient)
Container Gets the IContainer that contains the Component.
(Inherited from Component)
CookieContainer Gets or sets the cookies associated with this DevWebClient.
CookiesEnabled Gets or sets a value indicating whether cookies are enabled.

Default value is .

Credentials Gets or sets the network credentials that are sent to the host and used to authenticate the request.
(Inherited from WebClient)
Encoding Gets or sets the Encoding used to upload and download strings.
(Inherited from WebClient)
Headers Gets or sets a collection of header name/value pairs associated with the request.
(Inherited from WebClient)
IsBusy Gets whether a Web request is in progress.
(Inherited from WebClient)
Proxy Gets or sets the proxy used by this WebClient object.
(Inherited from WebClient)
QueryString Gets or sets a collection of query name/value pairs associated with the request.
(Inherited from WebClient)
RequestTimeout Gets or sets the time interval, in milliseconds, until the requests made by this DevWebClient times out.
ResponseHeaders Gets a collection of header name/value pairs associated with the response.
(Inherited from WebClient)
Site Gets or sets the ISite of the Component.
(Inherited from Component)
UseDefaultCredentials Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.
(Inherited from WebClient)

Methods

CancelAsync Cancels a pending asynchronous operation.
(Inherited from WebClient)
CreateObjRef 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 Releases all resources used by the Component.
(Inherited from Component)
DownloadData(String) Downloads the resource as a Byte array from the URI specified.
(Inherited from WebClient)
DownloadData(Uri) Downloads the resource as a Byte array from the URI specified.
(Inherited from WebClient)
DownloadDataAsync(Uri) Downloads the resource as a Byte array from the URI specified as an asynchronous operation.
(Inherited from WebClient)
DownloadDataAsync(Uri, Object) Downloads the resource as a Byte array from the URI specified as an asynchronous operation.
(Inherited from WebClient)
DownloadDataTaskAsync(String) Downloads the resource as a Byte array from the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
DownloadDataTaskAsync(Uri) Downloads the resource as a Byte array from the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
DownloadFile(String, String) Downloads the resource with the specified URI to a local file.
(Inherited from WebClient)
DownloadFile(Uri, String) Downloads the resource with the specified URI to a local file.
(Inherited from WebClient)
DownloadFileAsync(Uri, String) Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.
(Inherited from WebClient)
DownloadFileAsync(Uri, String, Object) Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.
(Inherited from WebClient)
DownloadFileTaskAsync(String, String) Downloads the specified resource to a local file as an asynchronous operation using a task object.
(Inherited from WebClient)
DownloadFileTaskAsync(Uri, String) Downloads the specified resource to a local file as an asynchronous operation using a task object.
(Inherited from WebClient)
DownloadString(String) Downloads the requested resource as a String. The resource to download is specified as a String containing the URI.
(Inherited from WebClient)
DownloadString(Uri) Downloads the requested resource as a String. The resource to download is specified as a Uri.
(Inherited from WebClient)
DownloadStringAsync(Uri) Downloads the resource specified as a Uri. This method does not block the calling thread.
(Inherited from WebClient)
DownloadStringAsync(Uri, Object) Downloads the specified string to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
DownloadStringTaskAsync(String) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
DownloadStringTaskAsync(Uri) Downloads the resource as a String from the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
GetType Gets the Type of the current instance.
(Inherited from Object)
InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
OpenRead(String) Opens a readable stream for the data downloaded from a resource with the URI specified as a String.
(Inherited from WebClient)
OpenRead(Uri) Opens a readable stream for the data downloaded from a resource with the URI specified as a Uri
(Inherited from WebClient)
OpenReadAsync(Uri) Opens a readable stream containing the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
OpenReadAsync(Uri, Object) Opens a readable stream containing the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
OpenReadTaskAsync(String) Opens a readable stream containing the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
OpenReadTaskAsync(Uri) Opens a readable stream containing the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
OpenWrite(String) Opens a stream for writing data to the specified resource.
(Inherited from WebClient)
OpenWrite(Uri) Opens a stream for writing data to the specified resource.
(Inherited from WebClient)
OpenWrite(String, String) Opens a stream for writing data to the specified resource, using the specified method.
(Inherited from WebClient)
OpenWrite(Uri, String) Opens a stream for writing data to the specified resource, by using the specified method.
(Inherited from WebClient)
OpenWriteAsync(Uri) Opens a stream for writing data to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
OpenWriteAsync(Uri, String) Opens a stream for writing data to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
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.
(Inherited from WebClient)
OpenWriteTaskAsync(String) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
OpenWriteTaskAsync(Uri) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
OpenWriteTaskAsync(String, String) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
OpenWriteTaskAsync(Uri, String) Opens a stream for writing data to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
ToString Returns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component)
UploadData(String, Byte) Uploads a data buffer to a resource identified by a URI.
(Inherited from WebClient)
UploadData(Uri, Byte) Uploads a data buffer to a resource identified by a URI.
(Inherited from WebClient)
UploadData(String, String, Byte) Uploads a data buffer to the specified resource, using the specified method.
(Inherited from WebClient)
UploadData(Uri, String, Byte) Uploads a data buffer to the specified resource, using the specified method.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
UploadDataAsync(Uri, String, Byte, Object) Uploads a data buffer to a resource identified by a URI, using the specified method and identifying token.
(Inherited from WebClient)
UploadDataTaskAsync(String, Byte) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadDataTaskAsync(Uri, Byte) Uploads a data buffer that contains a Byte array to the URI specified as an asynchronous operation using a task object.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
UploadFile(String, String) Uploads the specified local file to a resource with the specified URI.
(Inherited from WebClient)
UploadFile(Uri, String) Uploads the specified local file to a resource with the specified URI.
(Inherited from WebClient)
UploadFile(String, String, String) Uploads the specified local file to the specified resource, using the specified method.
(Inherited from WebClient)
UploadFile(Uri, String, String) Uploads the specified local file to the specified resource, using the specified method.
(Inherited from WebClient)
UploadFileAsync(Uri, String) Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
UploadFileTaskAsync(String, String) Uploads the specified local file to a resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadFileTaskAsync(Uri, String) Uploads the specified local file to a resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadFileTaskAsync(String, String, String) Uploads the specified local file to a resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadFileTaskAsync(Uri, String, String) Uploads the specified local file to a resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadString(String, String) Uploads the specified string to the specified resource, using the POST method.
(Inherited from WebClient)
UploadString(Uri, String) Uploads the specified string to the specified resource, using the POST method.
(Inherited from WebClient)
UploadString(String, String, String) Uploads the specified string to the specified resource, using the specified method.
(Inherited from WebClient)
UploadString(Uri, String, String) Uploads the specified string to the specified resource, using the specified method.
(Inherited from WebClient)
UploadStringAsync(Uri, String) Uploads the specified string to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
UploadStringAsync(Uri, String, String) Uploads the specified string to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
UploadStringAsync(Uri, String, String, Object) Uploads the specified string to the specified resource. This method does not block the calling thread.
(Inherited from WebClient)
UploadStringTaskAsync(String, String) Uploads the specified string to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadStringTaskAsync(Uri, String) Uploads the specified string to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadStringTaskAsync(String, String, String) Uploads the specified string to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadStringTaskAsync(Uri, String, String) Uploads the specified string to the specified resource as an asynchronous operation using a task object.
(Inherited from WebClient)
UploadValues(String, NameValueCollection) Uploads the specified name/value collection to the resource identified by the specified URI.
(Inherited from WebClient)
UploadValues(Uri, NameValueCollection) Uploads the specified name/value collection to the resource identified by the specified URI.
(Inherited from WebClient)
UploadValues(String, String, NameValueCollection) Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.
(Inherited from WebClient)
UploadValues(Uri, String, NameValueCollection) Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)
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.
(Inherited from WebClient)

Events

Disposed Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component)
DownloadDataCompleted Occurs when an asynchronous data download operation completes.
(Inherited from WebClient)
DownloadFileCompleted Occurs when an asynchronous file download operation completes.
(Inherited from WebClient)
DownloadProgressChanged Occurs when an asynchronous download operation successfully transfers some or all of the data.
(Inherited from WebClient)
DownloadStringCompleted Occurs when an asynchronous resource-download operation completes.
(Inherited from WebClient)
OpenReadCompleted Occurs when an asynchronous operation to open a stream containing a resource completes.
(Inherited from WebClient)
OpenWriteCompleted Occurs when an asynchronous operation to open a stream to write data to a resource completes.
(Inherited from WebClient)
UploadDataCompleted Occurs when an asynchronous data-upload operation completes.
(Inherited from WebClient)
UploadFileCompleted Occurs when an asynchronous file-upload operation completes.
(Inherited from WebClient)
UploadProgressChanged Occurs when an asynchronous upload operation successfully transfers some or all of the data.
(Inherited from WebClient)
UploadStringCompleted Occurs when an asynchronous string-upload operation completes.
(Inherited from WebClient)
UploadValuesCompleted Occurs when an asynchronous upload of a name/value collection completes.
(Inherited from WebClient)

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

GetEvent Gets a EventInfo that match the specified event name declared in the source Component.
(Defined by ComponentExtensions)
GetEventHandlers Gets all the delegates associated to the specified event raised by the source Component.
(Defined by ComponentExtensions)
GetEvents Gets all the events declared in the source Component.
(Defined by ComponentExtensions)
GetSubscribedEvents Gets a list of events declared in the source Component that are subscribed to a event-handler.
(Defined by ComponentExtensions)
InvokeUITypeEditorT Invokes the default UITypeEditor to edit the specified property.
(Defined by ComponentExtensions)
InvokeUITypeEditorT Invokes the default UITypeEditor to edit the specified property.
(Defined by ComponentExtensions)
IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)
TryGetEvent Tries to get a EventInfo that match the specified event name declared in the source Component.
(Defined by ComponentExtensions)

See Also