Namespace: System
Uri
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.
Properties (10)
String OriginalString
Gets the original URI string that was passed to the Uri constructor.
Value: A String containing the exact URI specified when this instance was constructed; otherwise, Empty.
String Scheme
Gets the scheme name for this URI.
Value: A String that contains the scheme for this URI, converted to lowercase.
String Host
Gets the host component of this instance.
Value: A String that contains the host name. This is usually the DNS host name or IP address of the server.
int Port
Gets the port number of this URI.
Value: An Int32 value that contains the port number for this URI.
String AbsolutePath
Gets the absolute path of the URI.
Value: A String containing the absolute path to the resource.
String Query
Gets any query information included in the specified URI.
Value: A String that contains any query information included in the specified URI.
String PathAndQuery
Gets the AbsolutePath and Query properties separated by a question mark (?).
Value: A String that contains the AbsolutePath and Query properties separated by a question mark (?).
bool IsAbsoluteUri
Gets whether the Uri instance is absolute.
Value: A Boolean value that is true if the Uri instance is absolute; otherwise, false.
String Authority
Gets the Domain Name System (DNS) host name or IP address and the port number for a server.
Value: A String containing the authority component of the URI represented by this instance.
String AbsoluteUri
Gets the absolute URI.
Value: A String containing the entire URI.
Methods (5)
Uri(String)Constructor
Initializes a new instance of the Uri class with the specified URI.
| Parameter | Description |
|---|---|
| uriString | A string that identifies the resource to be represented by the Uri instance. Note that an IPv6 address in string form must be enclosed within brackets. For example, "http://[2607:f8b0:400d:c06::69]". |
Uri(Uri,String)Constructor
Initializes a new instance of the Uri class based on the specified base URI and relative URI string.
| Parameter | Description |
|---|---|
| baseUri | The base URI. |
| relativeUri | The relative URI to add to the base URI. |
Uri(Uri,Uri)Constructor
Initializes a new instance of the Uri class based on the combination of a specified base Uri instance and a relative Uri instance.
| Parameter | Description |
|---|---|
| baseUri | An absolute Uri that is the base for the new Uri instance. |
| relativeUri | A relative Uri instance that is combined with baseUri. |
String ToString
Gets a canonical string representation for the specified Uri instance.
Returns: A String instance that contains the unescaped canonical representation of the Uri instance. All characters are unescaped except #, ?, and %.
bool IsHexDigit(Char)
Determines whether a specified character is a valid hexadecimal digit.
| Parameter | Description |
|---|---|
| character | The character to validate. |
Returns: true if the character is a valid hexadecimal digit; otherwise, false.