C# HtmlEncode

HtmlEncode function function converts some HTML special characters such as <, >, & and " into <, >, & and " etc.

string str="<table><tr><td>name<td>address</table>";
string str2 = System.Web.HttpUtility.HtmlEncode(str);
//&lt;table&gt;&lt;tr&gt;&lt;td&gt;name&lt;td&gt;address&lt;/table&gt;