public class UriBuilder
|
The UriBuilder properties provide read/write access to the read-only Uri properties so that they can be modified.
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the UriBuilder class. |
ctor #2 | Overloaded:.ctor(string uri) Initializes a new instance of the UriBuilder class with the specified URI. |
ctor #3 | Overloaded:.ctor(Uri uri) Initializes a new instance of the UriBuilder class with the specified Uri instance. |
ctor #4 | Overloaded:.ctor(string schemeName, string hostName) Initializes a new instance of the UriBuilder class with the specified scheme and host. |
ctor #5 | Overloaded:.ctor(string scheme, string host, int portNumber) Initializes a new instance of the UriBuilder class with the specified scheme, host, and port. |
ctor #6 | Overloaded:.ctor(string scheme, string host, int port, string pathValue) Initializes a new instance of the UriBuilder class with the specified scheme, host, port number, and path. |
ctor #7 | Overloaded:.ctor(string scheme, string host, int port, string path, string extraValue) Initializes a new instance of the UriBuilder class with the specified scheme, host, port number, path and query string or fragment identifier. |
Fragment | Read-write Gets or sets the fragment portion of the URI. |
Host | Read-write Gets or sets the Domain Name System (DNS) host name or IP address of a server. |
Password | Read-write Gets or sets the password associated with the user accessing the URI. |
Path | Read-write Gets or sets the path to the resource referenced by the URI. |
Port | Read-write Gets or sets the port number of the URI. |
Query | Read-write Gets or sets any query information included in the URI. |
Scheme | Read-write Gets or sets the scheme name of the URI. |
Uri | Read-only Gets the Uri instance constructed by the specified UriBuilder instance. |
UserName | Read-write The user name associated with the user accessing the URI. |
Equals | Overridden: Compares an existing Uri instance with the contents of the UriBuilder for equality. |
GetHashCode | Overridden: Returns the hash code for the URI. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString | Overridden: Returns the display string for the specified UriBuilder instance. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public UriBuilder(); |
public UriBuilder( |
uri
Exception Type | Condition |
---|---|
UriFormatException | uri is not a valid URI. |
public UriBuilder( |
uri
schemeName
hostName
UriBuilder myUri = new UriBuilder("http","www.contoso.com");
scheme
host
portNumber
UriBuilder myUri = new UriBuilder("http","www.contoso.com",8080);
scheme
host
port
pathValue
UriBuilder myUri = new UriBuilder("http","www.contoso.com",8080,"index.htm");
public UriBuilder( |
scheme
host
port
path
extraValue
Exception Type | Condition |
---|---|
ArgumentException | extraValue is neither a valid fragment indentifier containing a number sign (#) nor a valid query string containing a question mark (?). |
UriBuilder myUri = new UriBuilder("http","www.contoso.com",8080,"index.htm","#top");
public string Fragment {get; set;}
|
UriBuilder uBuild = new UriBuilder("http://www.contoso.com/"); uBuild.Path = "index.htm"; uBuild.Fragment = "main"; Uri myUri = uBuild.Uri;
public string Host {get; set;}
|
public string Password {get; set;}
|
public string Path {get; set;}
|
The path information does not include the scheme, host name, or query portion of the URI. The UriBuilder.Path property always returns at least a slash (/).
public int Port {get; set;}
|
public string Query {get; set;}
|
The query information is escaped according to RFC 2396.
Setting the UriBuilder.Query property to any value, including null, clears the UriBuilder.Fragment property. Setting the UriBuilder.Query property to null or to String.Empty clears the property.
Uri baseUri = new Uri("http://www.contoso.com/"); Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today"); Console.WriteLine(myUri.Query); . . . Uri baseUri = new Uri("http://www.contoso.com/"); Uri myUri = new Uri(baseUri, "catalog/shownew.htm?date=today"); Console.WriteLine(myUri.Query);
public string Scheme {get; set;}
|
Scheme | Description |
---|---|
file | The resource is a file on the local computer. |
ftp | The resource is accessed through FTP. |
gopher | The resource is accessed through the Gopher protocol. |
http | The resource is accessed through HTTP. |
https | The resource is accessed through secure HTTP. |
mailto | The resource is an e-mail address and is accessed through SMTP. |
news | The resources is accessed through NNTP. |
public Uri Uri {get;}
|
Exception Type | Condition |
---|---|
UriFormatException | The URI constructed by the UriBuilder properties is invalid. |
public string UserName {get; set;}
|
rparam
~UriBuilder(); |
public override int GetHashCode(); |
The hash codes for Uri A and B are guaranteed to be the same when A.Equals(B) is true.
This method implements Object.GetHashCode.
public Type GetType(); |
protected object MemberwiseClone(); |
public override string ToString(); |