Asp.net

Encoding HTML special characters

The HTML Encode method in asp.net applies HTML encoding to a specified string. This is useful method of encoding form data.It converts potentially unsafe characters to their HTML-encoded equivalent.

e.g.
() is converted to >.
(&) is converted to &.
(“) is converted to ".

How to Use:

1.
2. div.InnerHtml = Server.HtmlEncode(“Enter a word <here>”);

Leave a comment