HttpUtility.UrlDecode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將已編碼用於 URL 傳輸的字串轉換為解碼字串。
若要在網頁應用程式外編碼或解碼數值,請使用 該 WebUtility 類別。
多載
| 名稱 | Description |
|---|---|
| UrlDecode(String, Encoding) |
利用指定的編碼物件,將 URL 編碼的字串轉換為解碼字串。 |
| UrlDecode(Byte[], Int32, Int32, Encoding) |
將 URL 編碼的位元組陣列轉換為解碼字串,使用指定的編碼物件,從陣列中指定位置開始,並持續執行指定位元組數。 |
| UrlDecode(String) |
將已編碼用於 URL 傳輸的字串轉換為解碼字串。 |
| UrlDecode(Byte[], Encoding) |
利用指定的解碼物件,將 URL 編碼的位元組陣列轉換成解碼後的字串。 |
UrlDecode(String, Encoding)
利用指定的編碼物件,將 URL 編碼的字串轉換為解碼字串。
public:
static System::String ^ UrlDecode(System::String ^ str, System::Text::Encoding ^ e);
public static string? UrlDecode(string? str, System.Text.Encoding e);
public static string UrlDecode(string str, System.Text.Encoding e);
static member UrlDecode : string * System.Text.Encoding -> string
Public Shared Function UrlDecode (str As String, e As Encoding) As String
參數
- str
- String
要解碼的字串。
傳回
一個解碼的字串。
備註
如果在 HTTP 串流中傳遞空白和標點符號等字元,接收端可能會被誤解。 URL 編碼將不允許出現在 URL 中的字元轉換為字元實體等價物;URL 解碼則是反向編碼。 例如,當字元嵌入要傳送的 URL 文字區塊中時,字元 < 和 > 會被編碼為 %3c 和 %3e。
若要在網頁應用程式外編碼或解碼數值,請使用 該 WebUtility 類別。
另請參閱
適用於
UrlDecode(Byte[], Int32, Int32, Encoding)
將 URL 編碼的位元組陣列轉換為解碼字串,使用指定的編碼物件,從陣列中指定位置開始,並持續執行指定位元組數。
public:
static System::String ^ UrlDecode(cli::array <System::Byte> ^ bytes, int offset, int count, System::Text::Encoding ^ e);
public static string? UrlDecode(byte[]? bytes, int offset, int count, System.Text.Encoding e);
public static string UrlDecode(byte[] bytes, int offset, int count, System.Text.Encoding e);
static member UrlDecode : byte[] * int * int * System.Text.Encoding -> string
Public Shared Function UrlDecode (bytes As Byte(), offset As Integer, count As Integer, e As Encoding) As String
參數
- bytes
- Byte[]
解碼的位元組陣列。
- offset
- Int32
開始解碼的位元組位置。
- count
- Int32
需要解碼的位元組數。
傳回
一個解碼的字串。
例外狀況
bytes 是 null,但 count 不等於 0。
offset 大小 0 於或大於陣列的 bytes 長度。
-或-
count小於 0,或count + offset大於陣列的bytes長度。
備註
如果在 HTTP 串流中傳遞空白和標點符號等字元,接收端可能會被誤解。 URL 編碼將不允許出現在 URL 中的字元轉換為字元實體等價物;URL 解碼則是反向編碼。 例如,當嵌入要傳送的 URL 文字區塊時,字元 < 和 > 會編碼為 %3c 和 %3e。
若要在網頁應用程式外編碼或解碼數值,請使用 該 WebUtility 類別。
另請參閱
適用於
UrlDecode(String)
將已編碼用於 URL 傳輸的字串轉換為解碼字串。
public:
static System::String ^ UrlDecode(System::String ^ str);
public static string? UrlDecode(string? str);
public static string UrlDecode(string str);
static member UrlDecode : string -> string
Public Shared Function UrlDecode (str As String) As String
參數
- str
- String
要解碼的字串。
傳回
一個解碼的字串。
備註
如果在 HTTP 串流中傳遞空白和標點符號等字元,接收端可能會被誤解。 URL 編碼將不允許出現在 URL 中的字元轉換為字元實體等價物;URL 解碼則是反向編碼。 例如,當字元嵌入要傳送的 URL 文字區塊中時,字元 < 和 > 會被編碼為 %3c 和 %3e。
若要在網頁應用程式外編碼或解碼數值,請使用 該 WebUtility 類別。
另請參閱
適用於
UrlDecode(Byte[], Encoding)
利用指定的解碼物件,將 URL 編碼的位元組陣列轉換成解碼後的字串。
public:
static System::String ^ UrlDecode(cli::array <System::Byte> ^ bytes, System::Text::Encoding ^ e);
public static string? UrlDecode(byte[]? bytes, System.Text.Encoding e);
public static string UrlDecode(byte[] bytes, System.Text.Encoding e);
static member UrlDecode : byte[] * System.Text.Encoding -> string
Public Shared Function UrlDecode (bytes As Byte(), e As Encoding) As String
參數
- bytes
- Byte[]
解碼的位元組陣列。
傳回
一個解碼的字串。
備註
如果在 HTTP 串流中傳遞空白和標點符號等字元,接收端可能會被誤解。 URL 編碼將不允許出現在 URL 中的字元轉換為字元實體等價物;URL 解碼則是反向編碼。 例如,當字元嵌入要傳送的 URL 文字區塊中時,字元 < 和 > 會被編碼為 %3c 和 %3e。
若要在網頁應用程式外編碼或解碼數值,請使用 該 WebUtility 類別。