HttpUtility.UrlKeyValueEncode 方法 (String, String, TextWriter)
將編碼的字串索引鍵和用於 URL 查詢字串中的值,然後將其附加至指定的輸出資料流。
命名空間: Microsoft.SharePoint.Client.Utilities
組件: Microsoft.SharePoint.Client (在 Microsoft.SharePoint.Client.dll 中)
語法
'宣告
Public Shared Sub UrlKeyValueEncode ( _
keyToEncode As String, _
valueToEncode As String, _
output As TextWriter _
)
'用途
Dim keyToEncode As String
Dim valueToEncode As String
Dim output As TextWriterHttpUtility.UrlKeyValueEncode(keyToEncode, _
valueToEncode, output)
public static void UrlKeyValueEncode(
string keyToEncode,
string valueToEncode,
TextWriter output
)
參數
keyToEncode
類型:System.String要編碼索引鍵的字串。
valueToEncode
類型:System.String要編碼的值字串。
output
類型:System.IO.TextWriter表示您要新增編碼的鍵或值的輸出資料流TextWriter物件。
備註
使用UrlKeyValueEncode(Guid)方法編碼來建構,而不傳遞現有的 URL,例如的 URL、 使用者輸入的 URL。
若要編碼,作為屬性值 URL 類型屬性指定的字串,使用HtmlUrlAttributeEncode()方法。
若要編碼 HTML 字串,使用HtmlEncode(String)方法。
這種方式呈現 '=' 字元,以及編碼索引鍵和值字串輸出資料流。不過,您仍需要轉譯 」? 」 和 「 & 」 字元自己。