This documentation is archived and is not being maintained.

UriParser.GetComponents Method

Gets the components from a URI.

Namespace: System
Assembly: System (in system.dll)

protected virtual string GetComponents (
	Uri uri,
	UriComponents components,
	UriFormat format
protected String GetComponents (
	Uri uri, 
	UriComponents components, 
	UriFormat format
protected function GetComponents (
	uri : Uri, 
	components : UriComponents, 
	format : UriFormat
) : String
Not applicable.



The URI to parse.


The UriComponents to retrieve from uri.


One of the UriFormat values that controls how special characters are escaped.

Return Value

A string that contains the components.

Exception typeCondition


uriFormat is invalid.

- or -

uriComponents is not a combination of valid UriComponents values.


uri is not an absolute URI. Relative URIs cannot be used with this method.

Use the GetComponents method to determine the value of various parts of the URI, such as the Scheme, Host, or Port.

The components are returned in the order that they appear in the URI. For example, if Scheme is specified, it appears first.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0