HTML有转义字符?HTML应该就是标签语言。。。
//这几个函数对你应该有用
///
///过滤SQL/Html
///
///
///
publicstaticstringFilterSQL(stringtext)stringvalidSql="";
if(text!=null)text=text.Replace("\"",""");
//text=text.Replace(";","'';''");
//text=text.Replace("'","''");
//text=text.Replace("--","''--''");
//text=text.Replace("%25","");
//text=text.Replace("%0a","");
//text=text.Replace("%22","");
//text=text.Replace("%27","");
//text=text.Replace("%5c","");
//text=text.Replace("%2f","");
//text=text.Replace("%3c","");
//text=text.Replace("%3e","");
//text=text.Replace("%26","");
text=text.Replace("
text=text.Replace(">",">");
validSql=text;returnvalidSql;publicstaticstringFilterTestHtml(stringtext)stringvalidSql="";
if(text!=null)text=text.Replace("","");
text=text.Replace("&","&");
text=text.Replace("\n","
");
//text=text.Replace("\n","
");
//text=text.Replace("\r","
");
//text=text.Replace("\"",""");
//text=text.Replace(";","'';''");
//text=text.Replace("--","''--''");
//text=text.Replace("--","''--''");
//text=text.Replace("
//=text.Replace(">",">");
validSql=text;returnvalidSql;publicstaticstringUnFilterTestHtml(stringtext)stringvalidSql="";
if(text!=null)text=text.Replace("","");
text=text.Replace("
","\n");
//text=text.Replace(">",">");
validSql=text;returnvalidSql;[解决办法]
///
///去除HTML标记
///
///包括HTML的源码
///已经去除后的文字
publicstaticstringNoHTML(stringHtmlstring)//删除脚本
Htmlstring=Regex.Replace(Htmlstring,@"","",RegexOptions.IgnoreCase);
//删除HTML
Htmlstring=Regex.Replace(Htmlstring,@"]*)>","",RegexOptions.IgnoreCase);
Htmlstring=Regex.Replace(Htmlstring,@"([\r\n])[\s]+","",RegexOptions.IgnoreCase);
Htmlstring=Regex.Replace(Htmlstring,@"-->","",RegexOptions.IgnoreCase);
Htmlstring=Regex.Replace(Htmlstring,@"