<summary>
Clear the label in the HTML
</summary>
<param name= "Htmlstring" ></param>
<returns></returns>
public static string removehtml (String htmlstring)
{
Delete Script
htmlstring = Regex.Replace (htmlstring, @ "<script[^>]*?>.*?</script>", "", regexoptions.ignorecase);
Delete HTML
htmlstring = Regex.Replace (htmlstring, @ "< (. [ ^>]*) > "," ", regexoptions.ignorecase);
htmlstring = Regex.Replace (htmlstring, @ "([\ r \ n]) [\s]+", "", regexoptions.ignorecase);
htmlstring = Regex.Replace (htmlstring, @ "-and", "", regexoptions.ignorecase);
htmlstring = Regex.Replace (htmlstring, @ "<!--. *", "", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (quot| #34);", "\" ", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (amp| #38);", "&", Regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (lt| #60);", "<", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (gt| #62);", ">", Regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (nbsp| #160);", "", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (iexcl| #161);", "\xa1", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (cent| #162);", "\xa2", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (pound| #163);", "\xa3", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "& (copy| #169);", "\xa9", regexoptions.ignorecase);
Htmlstring = Regex.Replace (htmlstring, @ "(\d+);", "", regexoptions.ignorecase);
Htmlstring.replace ("<", "");
Htmlstring.replace (">", "");
Htmlstring.replace ("\ r \ n", "");
htmlstring = HttpContext.Current.Server.HtmlEncode (htmlstring). Trim ();
return htmlstring;
}
Clear All HTML tags