Microsoft Silverlight will reach end of support after October 2021. Learn more.
Converts a text string into a URL-encoded string.
Assembly: System.Windows.Browser (in System.Windows.Browser.dll)
'Declaration Public Shared Function UrlEncode ( _ url As String _ ) As String
public static string UrlEncode( string url )
The text to URL-encode.
A URL-encoded string.
If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding replaces characters that are not allowed in a URL with character-entity equivalents consisting of hexadecimal escape sequences. The converted string is expected to conform to the UTF-8 format.
URL encoding replaces all character codes except for letters, numbers, and the following punctuation characters:
- (minus sign)
! (exclamation point)
'(single quotation mark)
( and ) (opening and closing parentheses)
For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.
The UrlDecode method reverses the encoding.
Supported in: 5, 4, 3
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.