Mono Class Library: System.UriBuilder Overview | Members

System.UriBuilder Constructor

Constructs and initializes a new instance of the UriBuilder class using the specified URI.

public UriBuilder (string uri)

Parameters

uri
A string containing a URI.

Exceptions

TypeReason
ArgumentNullExceptionuri is null .
UriFormatException

uri is a zero length string or contains only spaces.

-or-

The parsing routine detected a scheme in an invalid form.

-or-

The parser detected more than two consecutive slashes in a URI that does not use the "file" scheme.

-or-

uri is in an invalid form and cannot be parsed.

Remarks

This constructor checks for the presence of a scheme in uri. If no scheme is found, Uri.UriSchemeHttp + Uri.SchemeDelimiter are prepended to uri. The Uri(string) constructor is passed uri, and the components of the new Uri instance are used to initialize the properties of the UriBuilder instance being constructed.

If uri.Fragment is not equal to string.Empty, uri.Fragment is copied to the UriBuilder.Fragment property of the current instance, otherwise uri.Query is copied to the UriBuilder.Query property of the current instance.

The Host, Port and Scheme properties of the Uri instance are used to initialize the corresponding properties in the current instance. The AbsolutePath property of the Uri instance is used to initialize the Path property of the current instance.

The UserInfo property of the Uri instance is used to initialize the UserName and Password properties of the current instance.

Requirements

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