I trying to block word in a comment and when they press submit it detect that it contain word such as <b> or <i>
i have written as this(below) somehow i was not able to block it
i have written as this(below) somehow i was not able to block it
Code:
Regex regExp = new Regex("^[a-zA-Z_]*$");
string subject = tbxSubject.Text;
string comment = tbxComments.Text;
string username = Request.QueryString["Username"];
string datePosted = Common.InsertTodayIntoCommentsDate();
bool status = CommentClass.InsertComment(comment, username, datePosted, subject);
if (regExp.IsMatch(status.ToString()))
{
lblStatus.Text = "Comment added successfully.";
lblStatus.ForeColor = System.Drawing.Color.Blue;
}
else
{
lblStatus.Text = "Comment failed to add!!!.";
lblStatus.ForeColor = System.Drawing.Color.Red;
}
Comment