Information
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.IsWellFormedUriString Method

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

Indicates whether the string is well-formed by attempting to construct a URI with the string.

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

public static bool IsWellFormedUriString (
	string uriString,
	UriKind uriKind
)
public static boolean IsWellFormedUriString (
	String uriString, 
	UriKind uriKind
)
public static function IsWellFormedUriString (
	uriString : String, 
	uriKind : UriKind
) : boolean

Parameters

uriString

A URI.

uriKind

The type of the URI in uriString.

Return Value

true if the string was well-formed in accordance with RFC 2396 and RFC 2732; else false.

The string is considered poorly formed if one or more of the following are true:

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 UriScheme indicates that the original string was not well-formed.

The example depends on the scheme of the URI.

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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft