如题

解决方案 »

  1.   

    在后台设置过滤字符
    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;
    }   
      

  2.   

     @ + 敏感词.ToString();
      

  3.   

    protected bool IsM(string InText)
    用正则来判断的  Regex.IsMatch