Try This function
public string StripHtml(string html)
{
return Regex.Replace(html, @”<(.\n)*?>”, string.Empty);
}
Some another way:
public static string StripHtml(string html, bool allowHarmlessTags)
{
if (html == null html == string.Empty) return string.Empty;
if (allowHarmlessTags)
return System.Text.RegularExpressions.Regex.Replace(html, "", string.Empty);
return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>”, string.Empty);
}
No comments:
Post a Comment