登录错误背后的Asp.net代码?
我在确定用户名是否为假时出错。我在代码隐藏中使用asp.net。它在下面突出显示。如果有人能告诉我错误是什么,那将是惊人的登录错误背后的Asp.net代码?,asp.net,.net,code-behind,Asp.net,.net,Code Behind,我在确定用户名是否为假时出错。我在代码隐藏中使用asp.net。它在下面突出显示。如果有人能告诉我错误是什么,那将是惊人的 protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { Boolean blnresult; blnresult = false; **blnresult = Authentication(
protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
{
Boolean blnresult;
blnresult = false;
**blnresult = Authentication(Login.UserName);**
if (blnresult == true)
{
e.Authenticated = true;
Session["Check"] = true;
}
else
e.Authenticated = false;
}
private bool Authentication(TextBox textBox)
{
throw new NotImplementedException();
}
protected static Boolean Authentication(string Username, string Password)
{
string sqlstring;
sqlstring = "SELECT userID FROM import_log.dbo.user_verification WHERE userID =" + Username + "";
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("Data Source = ietm-fwb-sql1; Initial Catalog = import_log; Persist Security Info = True; User ID = sa; Password = fwbadmin");
System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(sqlstring, con);
System.Data.SqlClient.SqlDataReader reader;
con.Open();
reader = comm.ExecuteReader();
if (reader.Read())
return true;
else
return false;
}
}
}
没有理由使用连接编写SQL。为pwnage做准备。对不起,那是什么意思?我是asp.net的新手,这是从别人给我的帮助中得到的。你已经为sql注入攻击打开了大门-在你做任何事情之前,我会解决这个问题:-本文很好地解释了它是什么,以及如何避免它:另外,如果您发布了所得到的错误,这将非常有帮助。您是否意识到您正在调用一个抛出NotImplementedException的方法?