protected void btnResetPassword_Click(object sender, EventArgs e) { User user = new User { Email = txtEmail.Text }; ECommerceBusiness ecb = new ECommerceBusiness { UserObj = user }; DataTable dt = ecb.ResetPassword(); if (dt.Rows.Count > 0) { string returnCode = dt.Rows[0]["ReturnCode"].ToString(); if (returnCode.Equals("1")) { string username = dt.Rows[0]["Username"].ToString(); string toEmail = dt.Rows[0]["Email"].ToString(); string uniqueID = dt.Rows[0]["UniqueID"].ToString(); try { SendPasswordResetMail(toEmail, username, uniqueID); lblStatus.Text = "An email with instructions to reset your password is sent to your email address"; lblStatus.ForeColor = System.Drawing.Color.Green; txtEmail.Text = string.Empty; } catch (Exception ex) { lblStatus.Text = "An unknown error occured!"; lblStatus.ForeColor = System.Drawing.Color.Red; } } else { lblStatus.Text = "Email not found!"; lblStatus.ForeColor = System.Drawing.Color.Red; } } else { lblStatus.Text = "Email not found!"; lblStatus.ForeColor = System.Drawing.Color.Red; } }