HttpUtility.UrlDecodeToBytes 方法

定義

將 URL 編碼的字串或位元組陣列轉換成解碼的位元組陣列。Converts a URL-encoded string or byte array into a decoded array of bytes.

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。To encode or decode values outside of a web application, use the WebUtility class.

多載

UrlDecodeToBytes(Byte[])

將 URL 編碼的位元組陣列轉換成已解碼的位元組陣列。Converts a URL-encoded array of bytes into a decoded array of bytes.

UrlDecodeToBytes(String)

將 URL 編碼的字串轉換成解碼的位元組陣列。Converts a URL-encoded string into a decoded array of bytes.

UrlDecodeToBytes(String, Encoding)

使用指定的解碼物件將 URL 編碼的字串轉換成已解碼的位元組陣列。Converts a URL-encoded string into a decoded array of bytes using the specified decoding object.

UrlDecodeToBytes(Byte[], Int32, Int32)

將 URL 編碼的位元組陣列轉換成已解碼的位元組陣列,起點在陣列中的指定位置,延續至指定的位元組數目。Converts a URL-encoded array of bytes into a decoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

UrlDecodeToBytes(Byte[])

將 URL 編碼的位元組陣列轉換成已解碼的位元組陣列。Converts a URL-encoded array of bytes into a decoded array of bytes.

public:
 static cli::array <System::Byte> ^ UrlDecodeToBytes(cli::array <System::Byte> ^ bytes);
public static byte[]? UrlDecodeToBytes (byte[]? bytes);
public static byte[] UrlDecodeToBytes (byte[] bytes);
static member UrlDecodeToBytes : byte[] -> byte[]
Public Shared Function UrlDecodeToBytes (bytes As Byte()) As Byte()

參數

bytes
Byte[]

要解碼的位元組陣列。The array of bytes to decode.

傳回

Byte[]

已解碼的位元組陣列。A decoded array of bytes.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL 編碼會將 URL 中不允許的字元轉換成對應的字元實體;URL 解碼會反轉編碼。URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. 例如,內嵌在要在 URL 中傳輸的文字區塊時,字元 < and > 會編碼為% 3c 和% 3e。For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。To encode or decode values outside of a web application, use the WebUtility class.

另請參閱

適用於

UrlDecodeToBytes(String)

將 URL 編碼的字串轉換成解碼的位元組陣列。Converts a URL-encoded string into a decoded array of bytes.

public:
 static cli::array <System::Byte> ^ UrlDecodeToBytes(System::String ^ str);
public static byte[]? UrlDecodeToBytes (string? str);
public static byte[] UrlDecodeToBytes (string str);
static member UrlDecodeToBytes : string -> byte[]
Public Shared Function UrlDecodeToBytes (str As String) As Byte()

參數

str
String

要解碼的字串。The string to decode.

傳回

Byte[]

已解碼的位元組陣列。A decoded array of bytes.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL 編碼會將 URL 中不允許的字元轉換成對應的字元實體;URL 解碼會反轉編碼。URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. 例如,內嵌在要在 URL 中傳輸的文字區塊時,字元 < and > 會編碼為% 3c 和% 3e。For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。To encode or decode values outside of a web application, use the WebUtility class.

另請參閱

適用於

UrlDecodeToBytes(String, Encoding)

使用指定的解碼物件將 URL 編碼的字串轉換成已解碼的位元組陣列。Converts a URL-encoded string into a decoded array of bytes using the specified decoding object.

public:
 static cli::array <System::Byte> ^ UrlDecodeToBytes(System::String ^ str, System::Text::Encoding ^ e);
public static byte[]? UrlDecodeToBytes (string? str, System.Text.Encoding e);
public static byte[] UrlDecodeToBytes (string str, System.Text.Encoding e);
static member UrlDecodeToBytes : string * System.Text.Encoding -> byte[]
Public Shared Function UrlDecodeToBytes (str As String, e As Encoding) As Byte()

參數

str
String

要解碼的字串。The string to decode.

e
Encoding

Encoding 物件,指定解碼配置。The Encoding object that specifies the decoding scheme.

傳回

Byte[]

已解碼的位元組陣列。A decoded array of bytes.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL 編碼會將 URL 中不允許的字元轉換成對應的字元實體;URL 解碼會反轉編碼。URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. 例如,內嵌在要在 URL 中傳輸的文字區塊時,字元 < and > 會編碼為% 3c 和% 3e。For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。To encode or decode values outside of a web application, use the WebUtility class.

另請參閱

適用於

UrlDecodeToBytes(Byte[], Int32, Int32)

將 URL 編碼的位元組陣列轉換成已解碼的位元組陣列,起點在陣列中的指定位置,延續至指定的位元組數目。Converts a URL-encoded array of bytes into a decoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

public:
 static cli::array <System::Byte> ^ UrlDecodeToBytes(cli::array <System::Byte> ^ bytes, int offset, int count);
public static byte[]? UrlDecodeToBytes (byte[]? bytes, int offset, int count);
public static byte[] UrlDecodeToBytes (byte[] bytes, int offset, int count);
static member UrlDecodeToBytes : byte[] * int * int -> byte[]
Public Shared Function UrlDecodeToBytes (bytes As Byte(), offset As Integer, count As Integer) As Byte()

參數

bytes
Byte[]

要解碼的位元組陣列。The array of bytes to decode.

offset
Int32

位元組陣列中要開始解碼的位置。The position in the byte array at which to begin decoding.

count
Int32

要解碼的位元組數。The number of bytes to decode.

傳回

Byte[]

已解碼的位元組陣列。A decoded array of bytes.

例外狀況

bytesnull,但 count 不等於 0bytes is null, but count does not equal 0.

offset 小於 0 或大於 bytes 陣列的長度。offset is less than 0 or greater than the length of the bytes array.

-或--or-

count 小於 0,或 count + offset 大於 bytes 陣列的長度。count is less than 0, or count + offset is greater than the length of the bytes array.

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,它們可能會在接收端被誤解。If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL 編碼會將 URL 中不允許的字元轉換成對應的字元實體;URL 解碼會反轉編碼。URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. 例如,內嵌在要在 URL 中傳輸的文字區塊時,字元 < and > 會編碼為% 3c 和% 3e。For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。To encode or decode values outside of a web application, use the WebUtility class.

另請參閱

適用於