protected void subString()
{
SqlConnection conSplit = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
SqlCommand cmdSplit = new SqlCommand("SELECT Password FROM Member WHERE (Username=@username AND Email=@email)", conSplit);
cmdSplit.Parameters.AddWithValue("@username", txtUsername.Text);
cmdSplit.Parameters.AddWithValue("@email", txtEmail.Text);
conSplit.Open();
SqlDataReader dtrSplit = cmdSplit.ExecuteReader();
if (dtrSplit.Read())
finalString = dtrSplit["Password"].ToString().Substring(0, 5);
dtrSplit.Close();
conSplit.Close();
}
protected void sendResetPass()
{
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add(txtEmail.Text);
mailMessage.From = new MailAddress("admin@MSJ.com");
mailMessage.Subject = "Password Reset";
mailMessage.Body = "New Password: " + finalString;
SmtpClient smtpClient = new SmtpClient("smtp.your-isp.com");
smtpClient.Send(mailMessage);
}
protected void ResetPassword(object sender, EventArgs e)
{
subString();
if (finalString != null)
{
SqlConnection conReset = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
SqlCommand cmdReset = new SqlCommand("UPDATE Member SET Password=@password WHERE Username=@username", conReset);
cmdReset.Parameters.AddWithValue("@username", txtUsername.Text);
cmdReset.Parameters.AddWithValue("@password", finalString);
conReset.Open();
cmdReset.ExecuteNonQuery();
conReset.Close();
sendResetPass();
Guest.Alert.Show("New Password has send to your E-mail/nplease do check your inbox");
ReturnToHome(sender, e);
}
else
Guest.Alert.Show("Invalid input: Username or E-mail have wrong input?");
}
i was doing research through google. But i got the error send ResetPassword executed
(A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 216.69.186.201:25)
What's the problem? or do i miss something important?