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();
            }
        }
    }
posted @ 2008-12-21 16:48  郑希强  阅读(233)  评论(0编辑  收藏  举报