Table of Contents

Class SecurityHelper

Namespace
SunamoHtml.Html
Assembly
SunamoHtml.dll

EN: Helper class for treating HTML code by removing dangerous scripts and JavaScript attributes. CZ: Pomocná třída pro ošetření HTML kódu odstraněním nebezpečných skriptů a JavaScript atributů.

public static class SecurityHelper
Inheritance
SecurityHelper
Inherited Members

Methods

RemoveJsAttributesFromEveryNode(string)

Removes all JavaScript-related attributes from every HTML node. Removes attributes starting with "on" (onclick, onload, etc.) and attributes with "javascript:" values.

public static string RemoveJsAttributesFromEveryNode(string html)

Parameters

html string

The HTML code to process.

Returns

string

HTML with JavaScript attributes removed.

TreatHtmlCode(string)

Treats HTML code by removing dangerous elements:

  • JavaScript attributes (onclick, onload, etc.)
  • Script tags
  • HTML comments
  • Non-breaking spaces
public static string TreatHtmlCode(string html)

Parameters

html string

The HTML code to treat.

Returns

string

Sanitized HTML code.