SPEncode.UrlEncodeAsUrl Method (String, Boolean)
Encodes the specified string, converting special characters to quoted UTF-8 format, but assumes that the string is a path component of a URL and encodes Unicode characters only if the encodeUnicodeCharacters parameter is true.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Shared Function UrlEncodeAsUrl ( _
str As String, _
encodeUnicodeCharacters As Boolean _
) As String
'Usage
Dim str As String
Dim encodeUnicodeCharacters As Boolean
Dim returnValue As String
returnValue = SPEncode.UrlEncodeAsUrl(str, _
encodeUnicodeCharacters)
public static string UrlEncodeAsUrl(
string str,
bool encodeUnicodeCharacters
)
Parameters
str
Type: System.StringThe string to encode as a URL.
encodeUnicodeCharacters
Type: System.Booleantrue to encode Unicode characters; otherwise, false.
Return Value
Type: System.String
The encoded string.
Remarks
Unlike the UrlEncode method, the UrlEncodeAsUrl method does not encode the forward slash ("/").