Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Uri.GetLeftPart Method

Returns the specified portion of a URI.

[Visual Basic]
Public Function GetLeftPart( _
   ByVal part As UriPartial _
) As String
public string GetLeftPart(
 UriPartial part
public: String* GetLeftPart(
 UriPartial part
public function GetLeftPart(
   part : UriPartial
) : String;


One of the UriPartial values that specifies the the end of the portion of the URI to return.

Return Value

A string containing the specified portion of the URI.


The GetLeftPart method returns a string containing the left-most portion of the URI, ending with the portion specified by part. The string returned includes delimiters but does not include any fragments or queries or their delimiters, except in certain cases.

GetLeftPart includes delimiters in the following cases:

  • Scheme has the scheme delimiter added.
  • Authority does not have the path delimiter added.
  • Path includes any delimiters in the original URI up to the query or fragment delimiter.

The following examples show a URI and the results of calling GetLeftPart with Scheme, Authority, or Path.

URI Scheme Authority Path http:// mailto:
nntp:// nntp:// nntp:// nntp:// news:
file://server/filename.ext file:// file://server file://server/filename.ext
file:/filename.ext file:   file:/filename.ext


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Uri Class | Uri Members | System Namespace

© 2018 Microsoft