HttpEncoder.UrlEncode(Byte[], Int32, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將不允許出現在 URL 中的字元陣列編碼成十六進位字元實體的等價物。
protected public:
virtual cli::array <System::Byte> ^ UrlEncode(cli::array <System::Byte> ^ bytes, int offset, int count);
protected internal virtual byte[] UrlEncode(byte[] bytes, int offset, int count);
abstract member UrlEncode : byte[] * int * int -> byte[]
override this.UrlEncode : byte[] * int * int -> byte[]
Protected Friend Overridable Function UrlEncode (bytes As Byte(), offset As Integer, count As Integer) As Byte()
參數
- bytes
- Byte[]
一個需要編碼的位元組陣列。
- offset
- Int32
陣列中 bytes 開始編碼的位置。
- count
- Int32
陣列中要編碼的項目 bytes 數量。
傳回
一組編碼字元。
例外狀況
offset 小於零或大於陣列長度 bytes 。
-或-
count 小於零,或 count 正 offset 值大於陣列長度 bytes 。
bytes 是 null。
備註
該 UrlEncode 方法由類別中的 HttpUtility 多個 URL 編碼方法呼叫。
URL 編碼方法對 UrlEncode 任何不屬於被視為 URL 安全的 ASCII 字元集合的字元進行編碼。 空格以 ASCII+" 字元編碼。 網址安全的 ASCII 字元包括 ASCII 字元(A 到 Z 和 a 到 z)、數字(0 到 9)以及一些標點符號。 下表列出被視為 URL 安全的 ASCII 字元的標點符號。
| 角色 | Description |
|---|---|
| - | 連字號 |
| _ | 底線 |
| . | 句點(點) |
| ! | 驚嘆號 |
| * | 星號(星) |
| ( | 開頭括號 |
| ) | 括號結束 |