This documentation is archived and is not being maintained.

HttpEncoder.UrlPathEncode Method

Encodes a subsection of a URL.

Namespace:  System.Web.Util
Assembly:  System.Web (in System.Web.dll)

protected internal virtual string UrlPathEncode(
	string value


Type: System.String
The string to encode.

Return Value

Type: System.String
A URL-encoded string.

The UrlPathEncode method is called by the UrlPathEncode method. The UrlPathEncode method performs the following steps:

  • Applies the encoding logic of the UrlPathEncode method to only the path part of the URL (which excludes the query string). The method assumes that the URL is encoded as a UTF-8 string.

  • Encodes non-spaces so that only a subset of the first 128 ASCII characters is used in the resulting encoded string. Any characters at Unicode value 127 and greater or less than 32 are URL-encoded. Spaces are not URL-encoded by this method, because ASP.NET encodes spaces as a separate operation in a helper class.

  • Encodes spaces as %20.

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.