This documentation is archived and is not being maintained.

UriParser.GetComponents Method

Note: This method is new in the .NET Framework version 2.0.

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



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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0