我的页面很容易被SQL注入,有什么方法可以防止注入呢?
我的一个内容页http://127.0.0.1/gs/ShowDown.aspx?ID=30
这个地址使用一个简单的SQL注入工具就可以注入。
看看我的ShowDown.aspx.CS文件,非常简单,也没有做相关的安全防护,以为不会,请各位教教我怎么防止SQL注入呢?
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string DownID = this.Request["ID"].ToString();
DataTable TaBle = MyWeb.MyData.GetDBOne("Down", DownID);
this.Label3.Text = TaBle.Rows[0]["Name"].ToString();
this.Label4.Text = TaBle.Rows[0]["Url"].ToString();
this.Label2.Text = TaBle.Rows[0]["Password"].ToString();
}