coding for forget password

Posted by reddysankark-13471 under ASP.NET on 2/20/2012 | Points: 10 | Views : 2101 | Status : [Member] | Replies : 2
hi
i need code for forget password without using membership in web.config file

sankarreddy


Responses

Posted by: Akbar.Jinna on: 2/20/2012 [Member] Starter | Points: 25

Up
0
Down
SQLConn = " your connection string "
query = "select Password,email from logininfo where login_name='" + loginname + "'";
SQLDA = new SqlDataAdapter(query, SQLConn);
forgotds= new DataSet();
SQLDA.Fill(forgotds);
rowcount = forgotds.Tables[0].Rows.Count;
if(rowcount>0)
{
email = forgotds.Tables[0].Rows[0]["email"].ToString();
password = forgotds.Tables[0].Rows[0]["password"].ToString();
try
{
MailMessage mail = new MailMessage();
mail.From = "from address";
mail.To = email;
mail.Subject = "Reg. Password ";
mail.Body = " Your Password for the user" + " "+ txtLoginName.Text.ToString() + " " + " is " + password;
SmtpMail.SmtpServer = "server ip address or Name";
SmtpMail.Send(mail);
lblmessage.Text = " The password has successfully sent to " + email;
}
catch (Exception ex)
{
Response.Write(ex.Message);

}
}
else
{
lblmessage.Text = " The login " + txtLoginName.Text + " is invalid ";
}
}

Akbar Jinna

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajkatie on: 2/20/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
You can used in-built 'Password recovery' control for forgot password functionality.

Rajesh Patel
.Net Trainer(MSCD | MCT | MS)
Brainbench (Asp.Net 4.5 and C# 5.0)

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response