// Filter HTML code
Public string checkStr (string html)
{
System. text. regularExpressions. regex regex1 = new System. text. regularExpressions. regex (@ "<script [sS] + </script *>", System. text. regularExpressions. regexOptions. ignoreCase );
System. text. regularExpressions. regex regex2 = new System. text. regularExpressions. regex (@ "href * = * [sS] * script *:", System. text. regularExpressions. regexOptions. ignoreCase );
System. Text. RegularExpressions. Regex regex3 = new System. Text. RegularExpressions. Regex (@ "on [sS] * =", System. Text. RegularExpressions. RegexOptions. IgnoreCase );
System. text. regularExpressions. regex regex4 = new System. text. regularExpressions. regex (@ "<iframe [sS] + </iframe *>", System. text. regularExpressions. regexOptions. ignoreCase );
System. text. regularExpressions. regex regex5 = new System. text. regularExpressions. regex (@ "<frameset [sS] + </frameset *>", System. text. regularExpressions. regexOptions. ignoreCase );
System. text. regularExpressions. regex regex6 = new System. text. regularExpressions. regex (@ "] +>", System. text. regularExpressions. regexOptions. ignoreCase );
System. Text. RegularExpressions. Regex regex7 = new System. Text. RegularExpressions. Regex (@ "</p>", System. Text. RegularExpressions. RegexOptions. IgnoreCase );
System. Text. RegularExpressions. Regex regex8 = new System. Text. RegularExpressions. Regex (@ "<p>", System. Text. RegularExpressions. RegexOptions. IgnoreCase );
Html = regex1.Replace (html, ""); // filter <script> </script> tags
Html = regex2.Replace (html, ""); // filter href = javascript: (<A>) attributes
Html = regex3.Replace (html, "_ disibledevent ="); // filter the on events of other controls
Html = regex4.Replace (html, ""); // filter iframe
Html = regex5.Replace (html, ""); // filter frameset
Html = regex6.Replace (html, ""); // filter frameset
Html = regex7.Replace (html, ""); // filter frameset