共用方式為


SPHttpUtility.UrlKeyValueEncode Method (String, String, TextWriter)

Encodes a string key and value for use in a URL query string, and then appends it to the specified output stream.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Sub UrlKeyValueEncode ( _
    keyToEncode As String, _
    valueToEncode As String, _
    output As TextWriter _
)
'Usage
Dim keyToEncode As String
Dim valueToEncode As String
Dim output As TextWriterSPHttpUtility.UrlKeyValueEncode(keyToEncode, _
    valueToEncode, output)
public static void UrlKeyValueEncode(
    string keyToEncode,
    string valueToEncode,
    TextWriter output
)

Parameters

  • valueToEncode
    Type: System.String

    The value string to be encoded.

  • output
    Type: System.IO.TextWriter

    A T:System.IO.TextWriter object that represents the output stream to which to add the encoded key or value.

Remarks

This method renders the '=' character along with the encoded key and value text to the output stream. This method does not render the '?' and '&' characters.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

UrlKeyValueEncode Overload

Microsoft.SharePoint.Utilities Namespace