HttpEncoder::UrlPathEncode Method (String^)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Encodes a subsection of a URL.

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

public protected:
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 128 and greater, or 32 and less, are URL-encoded.

  • Encodes spaces as %20.

.NET Framework
Available since 4.0
Return to top