이 줄의 오류 "message.To.Add (strCommandText);" 나는 데이터베이스에서 이메일 데이터를 가져 와서 이메일을 보내려고 할 때.메일 헤더에 유효하지 않은 문자가 있습니다 : ';'
공공 부분 클래스 beforeLogin_Auto_StaffPage : System.Web.UI.Page 당신은 할 추가 { 보호 무효를 Page_Load (개체를 보낸 사람, EventArgs입니다 전자) {
}
protected void btnApprove_Click(object sender, EventArgs e)
{
string approve = "Approve";
string strConnectionString = ConfigurationManager.ConnectionStrings["ChadBankConnectionString"].ConnectionString;
SqlConnection myConnection = new SqlConnection(strConnectionString);
myConnection.Open();
string strCommandText3 = "UPDATE AutoLoan SET autoStatus ='" + approve + "'WHERE userID= '" + Session["userID"] + "';";
SqlCommand myCommand3 = new SqlCommand(strCommandText3, myConnection);
myCommand3.ExecuteNonQuery();
string strCommandText = "SELECT custEmail From Customer WHERE userID= '" + Session["userID"] + "';";
SqlCommand myCommand = new SqlCommand(strCommandText, myConnection);
myCommand.ExecuteNonQuery();
string strCommandText1 = "SELECT loginName From Customer WHERE userID= '" + Session["userID"] + "';";
SqlCommand myCommand1 = new SqlCommand(strCommandText1, myConnection);
myCommand1.ExecuteNonQuery();
NetworkCredential myCred = new NetworkCredential("[email protected]", "627726627");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(strCommandText);
message.From = new MailAddress("[email protected]");
message.Subject = "CHAD Bank: Auto Loan Application Approved";
message.Body = "Hi " + strCommandText1 + "," + Environment.NewLine + Environment.NewLine +
"Your application for your auto loan are approved, payment will start on the next month";
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587;
client.Credentials = myCred;
client.EnableSsl = true;
client.Send(message);
myConnection.Close();
}
protected void gvDetail_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = gvDetail.SelectedRow;
Session["userID"] = row.Cells[10].Text;
}
}
귀하는 은행 계좌 정보를 취급하는 것으로 보이며 귀하는 ** SQL 주입에 매우 취약합니다. 이렇게하면 매우 개인적이고 위험한 정보를 보유하게되어 ** 걱정 스럽습니다 **. – Arran
이것은 우리가 은행 시스템을 만들길 원했던 학교 프로젝트입니다 –