Uri.IdnHost Uri.IdnHost Uri.IdnHost Uri.IdnHost Property


RFC 3490 根据需要使用 Punycode,符合主机的国际域名要求。The RFC 3490 compliant International Domain Name of the host, using Punycode as appropriate. 该字符串在不进行转义的情况下(如必要)可安全用于 DNS 解析。This string, after being unescaped if necessary, is safe to use for DNS resolution.

 property System::String ^ IdnHost { System::String ^ get(); };
public string IdnHost { get; }
member this.IdnHost : string
Public ReadOnly Property IdnHost As String


主机名,采用根据标准 IDN Punycode 格式。The hostname, formatted with Punycode according to the IDN standard.


需要 Punycode 窗体中的域名的较低级别网络协议用于提供此属性。This property is provided for the use of lower-level networking protocols that require the domain name in Punycode form. 如果你的代码不需要该特定的格式,使用Host主机名。If your code does not require that specific format, use Host for the hostname.

已弃用DnsSafeHost属性是依赖于app.config设置,Windows 应用商店应用程序不能更改。The deprecated DnsSafeHost property is dependent on app.config settings, which cannot be changed by Windows Store applications. 作为使用首选替代方法提供 IdnHost DnsSafeHost,因为IdnHost保证始终是安全的无论何种当前 DNS app.config可能设置。IdnHost is provided as the preferred alternative to using DnsSafeHost, because IdnHost is guaranteed to always be DNS safe, no matter what the current app.config settings might be.

如果已转义的字符串用于构造此实例 (例如,"http://[fe80::200:39ff:fe36:1a2d%254]/temp/example.htm"),然后 IdnHost 返回已转义的字符串。If you used an escaped string to construct this instance (for example, "http://[fe80::200:39ff:fe36:1a2d%254]/temp/example.htm"), then IdnHost returns an escaped string. 应取消之前进行 DNS 解析中使用该字符串从 IdnHost 返回任何已转义的字符串。You should unescape any escaped string returned from IdnHost before using that string for DNS resolution. 请注意,如果您使用了无效非转义的字符串将构造此实例 (例如,"http://[fe80::200:39ff:fe36:1a2d%4]/temp/example.htm"),然后 IdnHost 返回未转义的字符串。Be aware that if you used an invalid unescaped string to construct this instance (for example, "http://[fe80::200:39ff:fe36:1a2d%4]/temp/example.htm"), then IdnHost returns an unescaped string.