Use a regular expression to search for HTML variants and convert them to "" (nothing).
I've placed a simple function called StripHTML in a user-class called SystemFunctions as follows:
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;
public class SystemFunctions
{
public string StripHTML(string strInput)
{
return System.Web.HttpContext.Current.Server.HtmlDecode(Regex.Replace(strInput, "<(.|\n)*?>", ""));
}
}
* Make sure you add the reference to System.Text.RegularExpressions
No comments:
Post a Comment