ASP.NET 用 Global.asax 的Application_BeginRequest 事件过滤恶意提交
来源:互联网 发布:window10 windows.old 编辑:程序博客网 时间:2024/05/02 13:19
protected void Application_BeginRequest(object sender, EventArgs e)
{
//遍历Post参数,隐藏域除外
foreach (string i in this.Request.Form)
{
if (i == "__VIEWSTATE") continue;
this.goErr(this.Request.Form[i].ToString());
}
//遍历Get参数。
foreach (string i in this.Request.QueryString)
{
this.goErr(this.Request.QueryString[i].ToString());
}
}
private void goErr(string tm)
{
if (SqlFilter2(tm))
{
Response.Redirect("p404.html");
Response.End();
}
}
public static bool SqlFilter2(string InText)
{
string word = "and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join";
if (InText == null)
return false;
foreach (string i in word.Split('|'))
{
if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1))
{
return true;
}
}
return false;
}
- ASP.NET 用 Global.asax 的Application_BeginRequest 事件过滤恶意提交
- 采用Global.asax的Application_BeginRequest事件过滤敏感字符
- Asp.net Global.asax 事件的介绍
- Asp.net Global.asax 事件的介绍
- 关于触发asp.net Global.asax Session_End事件的经验
- Asp.net中Global.asax 的使用和事件
- Asp.net中Global.asax 的使用和事件
- Asp.net中Global.asax 的使用和事件
- Asp.net中Global.asax 的使用和事件
- 利用Global.asax的Application_BeginRequest 实现url 重写 无后缀
- Asp.net Global.asax
- ASP.NET的global.asax文件
- asp.net Global.asax文件的使用
- asp.net 控件生命周期和Global.asax事件顺序
- asp.net中global.asax中事件汇总
- ASP.NET中的Global.asax
- ASP.NET Global.asax详解
- ASP.NET的global.asax文件中的Application事件(一)
- 教你如何查看端口的使用情况(哪些程序使用了哪些端口)
- Drupal介绍(Drupal笔记一)
- 野人过河问题
- Hardcoded string "下一步", should use @string resource警告
- Struts2默认的配置
- ASP.NET 用 Global.asax 的Application_BeginRequest 事件过滤恶意提交
- 我的图片服务器和WEB应用服务器相分离的简单方案
- 连接池中的maxIdle,MaxActive,maxWait参数
- 线程间操作无效: 从不是创建控件“WaitForm”的线程访问它
- 10229 - Modular Fibonacci
- 2012-05-18
- atoi 函数
- 数据库的同步与数据库的复制技术
- 黑马程序员---手机号码查询