日期:2014-05-17  浏览次数:20398 次

问一个关于去除<html>标签的问题
我已经写好了 我不知道调用 求大神教我aspx页面调用这个类 下面是我写的代码
能详细的最好 谢谢 我的是内容是在girdview里显示 求大神给出页面调用代码 
 public static string ReplaceHtml(string html)
  {
  Regex regex = new Regex(@"<Applet(.*?)>((.|\n)*?)</Applet(\s)*>", RegexOptions.IgnoreCase);
  html = regex.Replace(html, ""); //过滤<Applet></Applet>标记

  regex = new Regex(@"<script(.*?)>((.|\n)*?)</script(\s)*>", RegexOptions.IgnoreCase);
  html = regex.Replace(html, ""); //过滤<script></script>标记

  regex = new Regex(@"<style(.*?)>((.|\n)*?)</style(\s)*>", RegexOptions.IgnoreCase);
  html = regex.Replace(html, ""); //过滤<style></style>标记

  string temp = Regex.Replace(html, "<[^>]*>", "");
  temp = temp.Replace("&nbsp;", " ");
  temp = temp.Replace("\r\n", " ");
  temp = temp.Replace("\r", " ");
  temp = temp.Replace("\n", " ");
  temp = temp.Replace("\t", " ");

  temp = temp.Replace("&mdash;", "—");

  temp = Regex.Replace(temp, @"(\s){3,}", " ");

  regex = new Regex(@"('(.*?)(\"")>)", RegexOptions.Multiline);
  temp = regex.Replace(temp, ""); //过滤<style></style>标记

  return temp;
  }

------解决方案--------------------
如果要调用方法需要把这一项改成模板列

你直接把我写的代码中的title换成你的内容content就可以了