ASP.NET涉及敏感词汇函数
public void wordsplit(string content)
{
StreamReader sr2 = new StreamReader(Server.MapPath("/admin/badword.txt"), Encoding.UTF8);
string old = sr2.ReadToEnd();
string[] arry;
arry = old.Split('|');
for (int i = 0; i < arry.Length; i++)
{
if (content.Contains(arry[i].ToString()))
{
Response.Write("<script language=javascript>alert('对不起,该信息涉及敏感词汇,无法发表!');</script>");
Response.End();
}
}
}
{
StreamReader sr2 = new StreamReader(Server.MapPath("/admin/badword.txt"), Encoding.UTF8);
string old = sr2.ReadToEnd();
string[] arry;
arry = old.Split('|');
for (int i = 0; i < arry.Length; i++)
{
if (content.Contains(arry[i].ToString()))
{
Response.Write("<script language=javascript>alert('对不起,该信息涉及敏感词汇,无法发表!');</script>");
Response.End();
}
}
}