Uri.IsWellFormedOriginalString Method

Definition

表示用以建構此 Uri 之字串的語式是否正確,而且不需要進一步逸出。Indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped.

public:
 bool IsWellFormedOriginalString();
public bool IsWellFormedOriginalString ();
member this.IsWellFormedOriginalString : unit -> bool
Public Function IsWellFormedOriginalString () As Boolean

Returns

Boolean

若字串語式正確,則為 true;否則為 falsetrue if the string was well-formed; otherwise, false.

Remarks

根據預設,此字串會被視為格式正確,並遵循 RFC 2396 和 RFC 2732。The string is considered to be well-formed in accordance with RFC 2396 and RFC 2732 by default. 如果已啟用國際資源識別碼(鳶尾花)或國際化功能變數名稱(IDN)剖析,則根據 RFC 3986 和 RFC 3987,字串會被視為格式正確If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the string is considered to be well-formed in accordance with RFC 3986 and RFC 3987

字串會被視為格式不正確,如果發生下列任何一種情況,則會導致方法傳回 false。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
此字串是代表隱含檔案 Uri的絕對 UriThe string is an absolute Uri that represents an implicit file Uri. c:\\directory\filename
此字串是絕對 URI,其在路徑前面缺少斜線。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 are treated as forward slashes. http:\\\host/path/file
此字串代表階層式絕對 Uri,且不包含 "://"。The string represents a hierarchical absolute Uri and does not contain "://". www.contoso.com/path/file
Uri.Scheme 的剖析器表示原始字串的格式不正確。The parser for the Uri.Scheme indicates that the original string was not well-formed. 此範例取決於 URI 的配置。The example depends on the scheme of the URI.

根據預設,用來建立此 Uri 的字串會被視為符合 RFC 2396 和 RFC 2732 的格式正確。By default, the string used to construct this Uri are considered well-formed in accordance with RFC 2396 and RFC 2732.

啟用國際資源識別碼(IRI)和國際化功能變數名稱(IDN)支援時,用來建立此 Uri 的字串會根據 RFC 3986 和 RFC 3987 視為格式正確。When International Resource Identifier (IRI) and Internationalized Domain Name (IDN) support are enabled, the string used to construct this Uri are considered well-formed in accordance with RFC 3986 and RFC 3987. 用來支援 IRI 的 Punycode 名稱只包含 ASCII 字元,且一律以 xn--前置詞開頭。Punycode names used to support IRI contain only ASCII characters and always start with the xn-- prefix.

如需 IRI 支援的詳細資訊,請參閱 Uri 類別的「備註」一節。For more information on IRI support, see the Remarks section for the Uri class.

Applies to

See also