System.Uri.DnsSafeHost Property

Gets an unescaped host name that is safe to use for DNS resolution.

Syntax

public string DnsSafeHost { get; }

Value

Documentation for this section has not yet been entered.

Remarks

For IPv6 addresses, the brackets ([]) are removed and the System.Net.IPAddress.ScopeId property is set, if one was specified when this instance was constructed.

The Uri.DnsSafeHost property has been extended in .NET Framework v3.5, 3.0 SP1, and 2.0 SP1 to provide International Resource Identifier (IRI) support based on RFC 3987. Current users will not see any change from the .NET Framework 2.0 behavior unless they specifically enable IRI. This ensures application compatibility with prior versions of the .NET Framework.

To enable support for IRI, the following two changes are required:

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]

Enabling IDN will convert all Unicode labels in a domain name to their Punycode equivalents. Punycode names contain only ASCII characters and always start with the xn-- prefix. The reason for this is to support existing DNS servers on the Internet, since most DNS servers only support ASCII characters (see RFC 3940).

Enabling IDN only affects the value of the Uri.DnsSafeHost property.

There are three possible values for IDN depending on the DNS servers that are used:

  • idn enabled = All

    This value will convert any Unicode domain names to their Punycode equivalents (IDN names).

  • idn enabled = AllExceptIntranet

    This value will convert all external Unicode domain names to use the Punycode equivalents (IDN names). In this case to handle international names on the local Intranet, the DNS servers that are used for the Intranet should support Unicode names.

  • idn enabled = None

    This value will not convert any Unicode domain names to use Punycode. This is the default value which is consistent with the .NET Framework 2.0 behaviour.

Enabling IRI parsing (iriParsing enabled = true) will do normalization and character checking according to the latest IRI rules in RFC 3987. The default value is false and will do normalization and character checking according to RFC 2396 and RFC 2732 (for IPv6 literals).

For more information on IRI support, see the Remarks section for the Uri class.

Requirements

Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0