Coder UrlEncode Method (String, String)C# API
Encodes a string using percent-encoding, specifying which characters should be encoded.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.7.98 (1.0.0.0)
Syntax

public static string UrlEncode(
	string urlFragment,
	string unsafeCharacters
)

Parameters

urlFragment
Type: System String
The text to percent-encode.
unsafeCharacters
Type: System String
A string containing a list of characters that need to be percent-encoded.

Return Value

The encoded text.
Remarks

A character in the string will be percent-encoded if:
  • It is outside the printable ASCII range (i.e. is not in the ASCII range 32 to 127) OR
  • It is one of the defined unsafeCharacters

For more information about percent-encoding, refer to OnlineRFC 3986.

Examples

The following example demonstrates encoding a string.
string encoded = Coder.UrlEncode("search?q=camera", "<>\"%{}|\\^[]` \n\t\r&");
// encoded == search%3Fq%3Dcamera
See Also