Udostępnij za pośrednictwem


Changes to the System.Uri namespace in Version 2.0

Several changes were made to the System.Uri class. These changes fixed incorrect behavior, enhanced usability, and enhanced security.

Obsolete and Deprecated Members

Constructors:

  • All constructors that have a dontEscape parameter.

Methods:

Changes

  • For URI schemes that are known to not have a query part (file, ftp, and others), the '?' character is always escaped and is not considered the beginning of a Query part.

  • For implicit file URIs (of the form "c:\directory\file@name.txt"), the fragment character ('#') is always escaped unless full unescaping is requested or LocalPath is true.

  • UNC hostname support was removed; the IDN specification for representing international hostnames was adopted.

  • LocalPath always returns a completely unescaped string.

  • ToString does not unescape an escaped '%', '?', or '#' character.

  • Equals now includes the Query part in the equality check.

  • Operators "==" and "!=" are overridden and linked to the Equals method.

  • IsLoopback now produces consistent results.

  • The URI "file:///path" is no longer translated into "file://path".

  • "#" is now recognized as a host name terminator. That is, "http://consoto.com#fragment" is now converted to "https://contoso.com/#fragment".

  • A bug when combining a base URI with a fragment has been fixed.

  • A bug in HostNameType is fixed.

  • A bug in NNTP parsing is fixed.

  • A URI of the form HTTP:contoso.com now throws a parsing exception.

  • The Framework correctly handles userinfo in a URI.

  • URI path compression is fixed so that a broken URI cannot traverse the file system above the root.

See Also

Reference

System.Uri