This topic has not yet been rated - Rate this topic

HttpUtility.HtmlEncode Method

Silverlight

Converts a text string into an HTML-encoded string.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)
public static string HtmlEncode(
	string html
)

Parameters

html
Type: System.String
The text to HTML-encode.

Return Value

Type: System.String
An HTML-encoded string.

An HTML document consists of text and control characters. Control characters cannot be displayed directly unless they are HTML-encoded.

For example, to display the character < (less than sign) in your HTML document, you must use the character sequence &lt;. Otherwise, it will be interpreted as the beginning of an HTML tag.

This method performs the following conversions to character-entity equivalents:

  • < to &lt;

  • > to &gt;

  • & to &amp;

  • " to &quot;

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ