C# Class Rock.Web.Utilities.HtmlSanitizer

Sanitation method from Rick Strahl's blog... http://weblog.west-wind.com/posts/2012/Jul/19/NET-HTML-Sanitation-for-rich-HTML-Input https://github.com/RickStrahl/HtmlSanitizer/blob/master/HtmlSanitizer/HtmlSanitizer/HtmlSanitizer.cs
Show file Open project: NewSpring/Rock Class Usage Examples

Public Properties

Property Type Description
BlackList HashSet

Public Methods

Method Description
Sanitize ( string html ) : string

Cleans up an HTML string by removing elements on the blacklist and all elements that start with onXXX .

SanitizeHtml ( string html ) : string

Cleans up an HTML string and removes HTML tags in blacklist

Private Methods

Method Description
HasExpressionLinks ( string value ) : bool
HasScriptLinks ( string value ) : bool
SanitizeHtmlNode ( HtmlNode node ) : void

Method Details

Sanitize() public method

Cleans up an HTML string by removing elements on the blacklist and all elements that start with onXXX .
public Sanitize ( string html ) : string
html string
return string

SanitizeHtml() public static method

Cleans up an HTML string and removes HTML tags in blacklist
public static SanitizeHtml ( string html ) : string
html string The HTML.
return string

Property Details

BlackList public property

The black list
public HashSet BlackList
return HashSet