WebUtility::UrlEncodeToBytes Method (array<Byte>^, Int32, Int32)
Converts a byte array into a URL-encoded byte array.
Assembly: System (in System.dll)
public: static array<unsigned char>^ UrlEncodeToBytes( array<unsigned char>^ value, int offset, int count )
Parameters
- value
-
Type:
array<System::Byte>^
The Byte array to URL-encode.
- offset
-
Type:
System::Int32
The offset, in bytes, from the start of the Byte array to encode.
- count
-
Type:
System::Int32
The count, in bytes, to encode from the Byte array.
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)
'(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 UrlDecodeToBytes method reverses the encoding.
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1