如何有效防止ASP.NET应用程序中的SQL注入攻击?
- 内容介绍
- 文章标签
- 相关推荐
本文共计554个文字,预计阅读时间需要3分钟。
在全局程序中添加过滤SQL敏感词,在Application BeginRequest事件中,遍历Post参数,隐藏域除外:
csharpprotected void Application_BeginRequest(object sender, EventArgs e){ // 遍历Post参数,隐藏域除外 foreach (string i in this.Request.Form) { if (i==__VIEWSTATE) continue; this.goErr(this.Request[i]); }}
在全局程序中添加过滤sql敏感
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(), i);
}
//遍历Get参数。
本文共计554个文字,预计阅读时间需要3分钟。
在全局程序中添加过滤SQL敏感词,在Application BeginRequest事件中,遍历Post参数,隐藏域除外:
csharpprotected void Application_BeginRequest(object sender, EventArgs e){ // 遍历Post参数,隐藏域除外 foreach (string i in this.Request.Form) { if (i==__VIEWSTATE) continue; this.goErr(this.Request[i]); }}
在全局程序中添加过滤sql敏感
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(), i);
}
//遍历Get参数。

