SPHttpUtility.UrlKeyValueEncode method (String)
Encodes a string for use in a URL query string.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function UrlKeyValueEncode ( _
keyOrValueToEncode As String _
) As String
'Usage
Dim keyOrValueToEncode As String
Dim returnValue As String
returnValue = SPHttpUtility.UrlKeyValueEncode(keyOrValueToEncode)
public static string UrlKeyValueEncode(
string keyOrValueToEncode
)
Parameters
keyOrValueToEncode
Type: System.StringThe key or value string to be encoded.
Return value
Type: System.String
The encoded string.
Remarks
Use the UrlKeyValueEncode 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 property.