Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetComponents Method

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

Parameters

uri

The URI to parse.

components

The UriComponents to retrieve from uri.

format

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

Return Value

A string that contains the components.

Exception typeCondition

ArgumentOutOfRangeException

uriFormat is invalid.

- or -

uriComponents is not a combination of valid UriComponents values.

InvalidOperationException

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

Community Additions

ADD
Show:
© 2015 Microsoft