惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
B
Blog RSS Feed
美团技术团队
博客园 - 【当耐特】
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
Vercel News
Vercel News
P
Proofpoint News Feed
IT之家
IT之家
I
InfoQ
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 江湖工夫

TextBox控件TextMode=Password时赋值 [转]随滚动条滚动的层(支持IE6,FF2) Iframe页面内容变更页面自动改变大小(非加载时自适应大小) 抓取网络文件的URL地址作附件发送 Visual SourceSafe应用守则[转] Microsoft SQL Server 分析服务 SQL中使用DISTINCT显示多个字段的方法(不使用DISTINCT了) GridView分页后跳转其他页面进行添加,编辑,删除操作后,仍返回到当前页码[原] Ajax的按钮事件效果 层的移动,使用了jquery asp.net(C#)处理数据一个通用类,包括存储过程,适用于初学者[转] IE和Firefox在JavaScript方面的兼容性(汇编) asp.net 对xml文件的读写,添加,修改,删除操作[转] 一些动画进度的图标链接 邹建的通用分页存储过程[转] 一个存储过程实现将Excel数据导入数据库 SQL SERVER事务处理[转] SQL与MDX语法的比较 一个存储过程
SQL注入的漏洞,过滤httprequest
江湖工夫 · 2008-05-09 · via 博客园 - 江湖工夫

在Global.asax文件中

protected void Application_BeginRequest(Object sender, EventArgs e)
        
{
            
//SQL防注入
            string Sql_1 = "exec|insert+|select+|delete|update|count|chr|mid|master+|truncate|char|declare|drop+|drop+table|creat+|creat+table";
            
string Sql_2 = "exec+|insert+|delete+|update+|count(|count+|chr+|+mid(|+mid+|+master+|truncate+|char+|+char(|declare+|drop+|creat+|drop+table|creat+table";
            
string[] sql_c = Sql_1.Split('|');
            
string[] sql_c1 = Sql_2.Split('|');
  
            
if(Request.QueryString != null)
            
{
                
foreach (string sl in sql_c)
                
{
                    
if(Request.QueryString.ToString().ToLower().IndexOf(sl.Trim()) >=0)
                    
{
                        Response.Write(
"警告!你的IP已经被记录!");//吓唬人的
                        Response.Write(sl);
                        Response.Write(Request.QueryString.ToString());
                        
//System.Windows.Forms.MessageBox.Show("禁止提交外部数据","1",System.Windows.F
                        
//orms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error,System.Windows.Forms.MessageBoxDefaultButton.Button1,System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly);
                        
//Response.Redirect("http://www.163.com");
                        Response.End();
                        
break;
                    }

                }

            }

   
            
if(Request.Form.Count > 0)
            
{
    
                
string s1 = Request.ServerVariables["SERVER_NAME"].Trim();//服务器名称
                if(Request.ServerVariables["HTTP_REFERER"!= null)
                
{
                    
string s2 = Request.ServerVariables["HTTP_REFERER"].Trim();//http接收的名称
                    string s3 = "";
                    
if(s1.Length > (s2.Length -7))
                    
{
                        s3 
= s2.Substring(7);
                    }

                    
else
                    
{
                        s3 
= s2.Substring(7,s1.Length);
                    }

                    
if(s3 != s1)
                    
{
                        Response.Write(
"你的IP已被记录!警告!");//吓人的
                        
//System.Windows.Forms.MessageBox.Show("禁止提交外部数据","1",System.Windows.Forms.MessageBoxButtons.OK,Sy
                        
//stem.Windows.Forms.MessageBoxIcon.Error,System.Windows.Forms.MessageBoxDefaultButton.Button1,System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly);
                        
//Response.Redirect("http://www.163.com");
                        Response.End();
                    }

                }
 
            }

        }