Share via


HtmlValidationContext.ValidateHtml Method (String, Boolean, Boolean)

Removes unsafe or disallowed HTML markup and returns validated HTML.

Namespace:  Microsoft.SharePoint.Publishing.Fields
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public Function ValidateHtml ( _
    inputHtml As String, _
    <OutAttribute> ByRef tagsWereDropped As Boolean, _
    <OutAttribute> ByRef urlsWereDropped As Boolean _
) As String
'Usage
Dim instance As HtmlValidationContext
Dim inputHtml As String
Dim tagsWereDropped As Boolean
Dim urlsWereDropped As Boolean
Dim returnValue As String

returnValue = instance.ValidateHtml(inputHtml, _
    tagsWereDropped, urlsWereDropped)
public string ValidateHtml(
    string inputHtml,
    out bool tagsWereDropped,
    out bool urlsWereDropped
)

Parameters

  • tagsWereDropped
    Type: System.Boolean

    On return, this parameter is set to True if any disallowed tags are found and removed during validation. Otherwise, set to False.

  • urlsWereDropped
    Type: System.Boolean

    On return, this parameter is set to True if any disallowed URLs are found and removed during validation. Otherwise, set to False.

Return Value

Type: System.String
The validated HTML, from which all unsafe or disallowed content is removed.

Remarks

Removes any tags, attributes, or markup from an HTML string that are unsafe or do not conform to the constraint settings that are applied to this HtmlValidationContext object.

See Also

Reference

HtmlValidationContext Class

HtmlValidationContext Members

ValidateHtml Overload

Microsoft.SharePoint.Publishing.Fields Namespace

ValidateHtml