|
Html Encoding is basically converting Html tags in non Html tags so that they can
be embeded into a html code. Below code explains how rendering of a html string
may vary because of html encoding
string htmlString = "<b>Hello world!</b>";
Response.Write(htmlString);
// This will print: Hello world!
string htmlEncoded = Server.HtmlEncode(htmlString);
Response.Write(htmlEncoded);
// This will print: <b>Hello world!</b>
You may want to Html encode a string before showing any user input on the page
|