HttpUtility.UrlDecode 方法

定義

將在 URL 中傳輸的已編碼字串轉換成已解碼的字串。

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。

多載

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 System::String ^ UrlDecode(System::String ^ s, System::Text::Encoding ^ e);
public static string? UrlDecode (string? str, System.Text.Encoding e);
public static string UrlDecode (string str, System.Text.Encoding e);
public static string UrlDecode (string s, System.Text.Encoding e);
static member UrlDecode : string * System.Text.Encoding -> string
static member UrlDecode : string * System.Text.Encoding -> string
Public Shared Function UrlDecode (str As String, e As Encoding) As String
Public Shared Function UrlDecode (s As String, e As Encoding) As String

參數

strs
String

要解碼的字串。

e
Encoding

指定解碼配置的 Encoding

傳回

String

已解碼的字串。

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,在接收端可能會誤譯這些字元。 URL 編碼會將 URL 中不允許的字元轉換成字元實體對等專案;URL 解碼會反轉編碼。 例如,當內嵌在要以 URL 傳輸的文字區塊時,字元 < and > 會編碼為 %3c 和 %3e。

若要編碼或解碼 Web 應用程式之外的值,請使用 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

要解碼的位元組數。

e
Encoding

Encoding 物件,指定解碼配置。

傳回

String

已解碼的字串。

例外狀況

bytesnull,但 count 不等於 0

offset 小於 0 或大於 bytes 陣列的長度。

-或-

count 小於 0,或 count + offset 大於 bytes 陣列的長度。

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,在接收端可能會誤譯這些字元。 URL 編碼會將 URL 中不允許的字元轉換成字元實體對等專案;URL 解碼會反轉編碼。 例如,當內嵌在 URL 中傳輸的文字區塊時,字元 < and > 會編碼為 %3c 和 %3e。

若要編碼或解碼 Web 應用程式之外的值,請使用 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

要解碼的字串。

傳回

String

已解碼的字串。

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,在接收端可能會誤譯這些字元。 URL 編碼會將 URL 中不允許的字元轉換成字元實體對等專案;URL 解碼會反轉編碼。 例如,當內嵌在要以 URL 傳輸的文字區塊時,字元 < and > 會編碼為 %3c 和 %3e。

若要編碼或解碼 Web 應用程式之外的值,請使用 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[]

要解碼的位元組陣列。

e
Encoding

指定解碼配置的 Encoding

傳回

String

已解碼的字串。

備註

如果在 HTTP 資料流程中傳遞空白和標點符號之類的字元,在接收端可能會誤譯這些字元。 URL 編碼會將 URL 中不允許的字元轉換成字元實體對等專案;URL 解碼會反轉編碼。 例如,當內嵌在要以 URL 傳輸的文字區塊時,字元 < and > 會編碼為 %3c 和 %3e。

若要編碼或解碼 Web 應用程式之外的值,請使用 WebUtility 類別。

另請參閱

適用於