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); //<table><tr><td>name<td>address</table>