Share via


HttpUtility.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.Client.Utilities
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

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 TextWriterHttpUtility.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.

Remarks

Use the UrlKeyValueEncode(Guid) method to encode a URL that you are constructing instead of passing an existing URL, for example, a URL that was entered by the user.

To encode the specified string for use as an attribute value for URL type attributes, use the HtmlUrlAttributeEncode() method.

To encode an HTML string, use the HtmlEncode(String) method.

This method renders the '=' character along with the encoded key and value string to the output stream. However, you still need to render the '?' and '&' characters yourself.

See Also

Reference

HttpUtility Class

HttpUtility Members

UrlKeyValueEncode Overload

Microsoft.SharePoint.Client.Utilities Namespace