Uri.IdnHost Property

Definition

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

Property Value

The hostname, formatted with Punycode according to the IDN standard.

Exceptions

This instance represents a relative URI, and this property is valid only for absolute URIs.

Remarks

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.

Applies to