Forgot Password in ASP.NET
How can we create and implement Forgot Password module in ASP.NET MVC ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Abhishek JaiswalRank #126 · 17.4K pointsPosted Jul 10, 2014, 5:12 AM EDT
follow these steps:
1: first of all verify that the user who forgot his password is registered or valid user
(you can do that through security question or any unique field according to you)
2: create a new page for user validation
3: create a code for updation in database on button click event and store it to ur database
code as
protected void Button_Click(object sender, EventArgs e)
{
string strcon = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
SqlConnection con = new SqlConnection(strcon);
con.Open();
SqlCommand cmd = new SqlCommand("Update table ABC set N= @N where S= @S", con);
cmd.Parameters.Add("@N", SqlDbType.NVarChar).Value = TextBox1.Text;
cmd.Parameters.Add("@S", SqlDbType.Decimal).Value = TextBox2.Text;
int rowseffected = cmd.ExecuteNonQuery();
}
thats all! :)