1. 首页
  2. 数据库
  3. 其它
  4. C#防SQL注入之SqlParameter参数化

C#防SQL注入之SqlParameter参数化

上传者: 2020-12-30 14:02:51上传 PDF文件 30KB 热度 25次
开发的时候为了方便快速,经常会使用SQL语句拼接的方式,这往往让不法分子有了可乘之机,利用漏洞进行SQL注入,做一些不可描述的事情 SqlCommand cmd = new SqlCommand(); cmd.CommandText = select * from user where username=' + username + ' and password=' + password + '; 所以我们必须丢弃上面这种方式,使用SqlParameter进行参数化,这样才能提升代码健壮性 SqlCommand cmd = new SqlCommand(); cmd.Comman
下载地址
用户评论