62,046
社区成员
发帖
与我相关
我的任务
分享
string strContent = "你这个大坏蛋,惹火了弄死你。其它乱七八糟的什么都有。哇卡卡卡。。。。大傻瓜";
string[] arryWords = { "坏蛋", "傻瓜", "弄死","短信" };
List<string> listWords = new List<string>();
listWords 中的结果应该是 坏蛋,傻瓜,弄死
void Application_BeginRequest(object sender, EventArgs e)
{
for (int i=0; i < Request.Form.Count;i++)
{
if (Request.Form[i].ToString() == "__VIEWSTATE") continue;
if (IsM(Request.Form[i].ToString()))
{
Response.Write("您提交的内容中含有非法字符.");
Response.End();
}
}
}
protected bool IsM(string InText)
{
string word = @"";
if (InText == null)
return false;
if (Regex.IsMatch(InText,word))
return true;
return false;
}
Regex.Replace