How to remove Bad Junk HTML Tags in C#

public static string RemoveBadHTMLTags(string htmlContent)
{
    Regex TagRegex = new Regex(
      “(<script>.*</script>)|(<object>.*</object>)|(<body>.*</body>) |
     (<embed>.*</embed>)|(<frameset>.*</frameset>)|


(<frame>.*</frame>)|
     (<iframe>.*</iframe>)|(<meta>.*</meta>)|(<ling>.*</ling>)|
     (<style>.*</style>)”);
    html = TagRegex.Replace(htmlContent, “”);
    return htmlContent;


by admin on May 27th, 2009 in ASP.Net

There are no comments.

Name*: Website: E-Mail*:
XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>