This documentation is archived and is not being maintained.

Uri.Uri(String) Constructor

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

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

'Declaration
Public Sub New ( _
	uriString As String _
)
'Usage
Dim uriString As String

Dim instance As New Uri(uriString)
public Uri (
	String uriString
)
public function Uri (
	uriString : String
)
Not applicable.

Parameters

uriString

A URI.

Exception typeCondition

ArgumentNullException

uriString is a null reference (Nothing in Visual Basic).

UriFormatException

uriString is empty.

-or-

The scheme specified in uriString is not correctly formed. See CheckSchemeName.

-or-

uriString contains too many slashes.

-or-

The password specified in uriString is not valid.

-or-

The host name specified in uriString is not valid.

-or-

The file name specified in uriString is not valid.

-or-

The user name specified in uriString is not valid.

-or-

The host or authority name specified in uriString cannot be terminated by backslashes.

-or-

The port number specified in uriString is not valid or cannot be parsed.

-or-

The length of uriString exceeds 65534 characters.

-or-

The length of the scheme specified in uriString exceeds 1023 characters.

-or-

There is an invalid character sequence in uriString.

-or-

The MS-DOS path specified in uriString must start with c:\\.

This constructor creates a Uri instance from a URI string. It parses the URI, puts it in canonical format, and makes any required escape encodings.

This constructor does not ensure that the Uri refers to an accessible resource.

The following example creates a Uri instance with the URI "http://www.contoso.com/".

Dim myUri As New Uri("http://www.contoso.com/")


Uri myUri = new Uri("http://www.contoso.com/");

var myUri : Uri = new Uri("http://www.contoso.com/");

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, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0
Show: