WebUtility.UrlEncode(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a text string into a URL-encoded string.
public:
static System::String ^ UrlEncode(System::String ^ value);
public static string UrlEncode (string value);
public static string? UrlEncode (string? value);
static member UrlEncode : string -> string
Public Shared Function UrlEncode (value As String) As String
Parameters
- value
- String
The text to URL-encode.
Returns
A URL-encoded string.
Remarks
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)_
(underscore).
(period)!
(exclamation point)*
(asterisk)(
and)
(opening and closing parentheses)
Each ' ' (space) character is converted to a +
(plus) character.
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.
Applies to
Обратна връзка
https://aka.ms/ContentUserFeedback.
Очаквайте скоро: През цялата 2024 г. постепенно ще отстраняваме проблемите в GitHub като механизъм за обратна връзка за съдържание и ще го заменим с нова система за обратна връзка. За повече информация вижте:Подаване и преглед на обратна връзка за