Uri.IdnHost Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the RFC 3490 compliant International Domain Name of the host, using Punycode as appropriate. This string, after being unescaped if necessary, is safe to use for DNS resolution.
public:
property System::String ^ IdnHost { System::String ^ get(); };
public string IdnHost { get; }
member this.IdnHost : string
Public ReadOnly Property IdnHost As String
The hostname, formatted with Punycode according to the IDN standard.
This instance represents a relative URI, and this property is valid only for absolute URIs.
This property is provided for the use of lower-level networking protocols that require the domain name in Punycode form. If your code does not require that specific format, use Host for the hostname.
The deprecated DnsSafeHost property is dependent on app.config settings, which cannot be changed by Windows Store applications. 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.
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. You should unescape any escaped string returned from IdnHost before using that string for DNS resolution. 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.
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |