Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

Hierarchy (view full)

Constructors

  • Initializes a new instance of the System.Uri class with the specified URI.

    Parameters

    • uriString: string | String

      A string that identifies the resource to be represented by the System.Uri instance. Note that an IPv6 address in string form must be enclosed within brackets. For example, "http://[2607:f8b0:400d:c06::69]".

    Returns Uri

  • Initializes a new instance of the System.Uri class based on the specified base URI and relative URI string.

    Parameters

    • baseUri: Uri

      The base URI.

    • relativeUri: string | String

      The relative URI to add to the base URI.

    Returns Uri

Accessors

  • get AbsolutePath(): string
  • Gets the absolute path of the URI.

    Returns string

    A System.String containing the absolute path to the resource.

  • get AbsoluteUri(): string
  • Gets the absolute URI.

    Returns string

    A System.String containing the entire URI.

  • get Authority(): string
  • Gets the Domain Name System (DNS) host name or IP address and the port number for a server.

    Returns string

    A System.String containing the authority component of the URI represented by this instance.

  • get Fragment(): string
  • Gets the escaped URI fragment.

    Returns string

    A System.String that contains any URI fragment information.

  • get Host(): string
  • Gets the host component of this instance.

    Returns string

    A System.String that contains the host name. This is usually the DNS host name or IP address of the server.

  • get IsAbsoluteUri(): boolean
  • Gets whether the System.Uri instance is absolute.

    Returns boolean

    A System.Boolean value that is true if the System.Uri instance is absolute; otherwise, false.

  • get IsFile(): boolean
  • Gets a value indicating whether the specified System.Uri is a file URI.

    Returns boolean

    A System.Boolean value that is true if the System.Uri is a file URI; otherwise, false.

  • get IsLoopback(): boolean
  • Gets whether the specified System.Uri references the local host.

    Returns boolean

    A System.Boolean value that is true if this System.Uri references the local host; otherwise, false.

  • get OriginalString(): string
  • Gets the original URI string that was passed to the System.Uri constructor.

    Returns string

    A System.String containing the exact URI specified when this instance was constructed; otherwise, System.String.Empty.

  • get Port(): number
  • Gets the port number of this URI.

    Returns number

    An System.Int32 value that contains the port number for this URI.

  • get Query(): string
  • Gets any query information included in the specified URI.

    Returns string

    A System.String that contains any query information included in the specified URI.

  • get Scheme(): string
  • Gets the scheme name for this URI.

    Returns string

    A System.String that contains the scheme for this URI, converted to lowercase.

Methods

  • Casts this object to the specified type. Throws error on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns T1

  • Determines whether the specified object is equal to the current object.

    Parameters

    • obj: any

      The object to compare with the current object.

    Returns boolean

    true if the specified object is equal to the current object; otherwise, false.

  • Serves as the default hash function.

    Returns number

    A hash code for the current object.

  • Determines whether the current System.Uri instance is a base of the specified System.Uri instance.

    Parameters

    Returns boolean

    true if the current System.Uri instance is a base of uri; otherwise, false.

  • Returns a string that represents the current object.

    Returns string

    A string that represents the current object.

  • Casts this object to the specified type. Returns null on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns null | T1

  • Determines whether the specified object instances are considered equal.

    Parameters

    • objA: any

      The first object to compare.

    • objB: any

      The second object to compare.

    Returns boolean

    true if the objects are considered equal; otherwise, false. If both objA and objB are null, the method returns true.

  • Converts a string to its escaped representation.

    Parameters

    • stringToEscape: string | String

      The string to escape.

    Returns string

    A System.String that contains the escaped representation of stringToEscape.

  • Converts a string to its unescaped representation.

    Parameters

    • stringToUnescape: string | String

      The string to unescape.

    Returns string

    A System.String that contains the unescaped representation of stringToUnescape.