Export (0) Print
Expand All

Uri.IsWellFormedUriString Method

Indicates whether the string is well-formed by attempting to construct a URI with the string and ensures that the string does not require further escaping.

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

'Declaration
Public Shared Function IsWellFormedUriString ( _
	uriString As String, _
	uriKind As UriKind _
) As Boolean

Parameters

uriString
Type: System.String
The string used to attempt to construct a Uri.
uriKind
Type: System.UriKind
The type of the Uri in uriString.

Return Value

Type: System.Boolean
A Boolean value that is true if the string was well-formed; else false.

By default, the string is considered well-formed in accordance with RFC 2396 and RFC 2732. If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the string is considered well-formed in accordance with RFC 3986 and RFC 3987.

The string is considered poorly formed, causing the method to return false, if any of the following conditions occur

Error

Example

The string is not correctly escaped.

http://www.contoso.com/path???/file name

The string is an absolute Uri that represents an implicit file Uri.

c:\\directory\filename

The string is an absolute URI that is missing a slash before the path.

file://c:/directory/filename

The string contains unescaped backslashes even if they will be treated as forward slashes

http:\\host/path/file

The string represents a hierarchical absolute Uri and does not contain "://"

www.contoso.com/path/file

The parser for the Scheme indicates that the original string was not well-formed.

The example depends on the scheme of the URI.

For more information on IRI support, see the Remarks section for the Uri class.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft