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)

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

  • encodeUnicodeCharacters
    Type: System.Boolean

    true 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 ("/").

See also

Reference

SPEncode class

SPEncode members

UrlEncodeAsUrl overload

Microsoft.SharePoint.Utilities namespace