Htmlstring.Replace("<", "");
Htmlstring.Replace(">", "");
//Htmlstring.Replace("\r\n", "");
Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring);
Htmlstring = Regex.Replace(Htmlstring, @"((\r\n))", "<br>");
Htmlstring = Regex.Replace(Htmlstring, @"(\r|\n)", "<br>");
Htmlstring = Regex.Replace(Htmlstring, @"(\s)", " ");
return Htmlstring;
}
这个过滤可以用于让用户输入发布内容时的过滤。