SPHttpUtility.HtmlEncode Method (String)

Encodes the specified string for use as text between HTML tags, or as an attribute value inside an HTML tag.

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 HtmlEncode ( _
    valueToEncode As String _
) As String
'Usage
Dim valueToEncode As String
Dim returnValue As String

returnValue = SPHttpUtility.HtmlEncode(valueToEncode)
public static string HtmlEncode(
    string valueToEncode
)

Parameters

Return Value

Type: System.String
The encoded string.

Remarks

The HtmlEncode method replaces ampersand, double-quotation, single-quotation, less-than, and greater-than characters with the appropriate entity references.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

HtmlEncode Overload

Microsoft.SharePoint.Utilities Namespace