System.Net.WebClient.BaseAddress Property

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

Syntax

public string BaseAddress { get; set; }

Value

A string containing the base URI for requests made by a System.Net.WebClient or, string.Empty, if no value was set or null was specified for a set operation.

Exceptions

TypeReason
ArgumentExceptionThe value specified for a set operation is not null or string.Empty, and is not a URI in a format recognized by the Uri class.

Remarks

The WebClient.BaseAddress property contains a base URI that is combined with a relative address. When you call a method that uploads or downloads data, the System.Net.WebClient object combines this base URI with the relative address you specify in the method call. If you specify an absolute URI, System.Net.WebClient does not use the WebClient.BaseAddress property value.

To remove a previously set value, set this property to null or an empty string ("").

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0