how to create forget password

Posted by reddysankark-13471 under ASP.NET on 2/28/2012 | Points: 10 | Views : 3514 | Status : [Member] | Replies : 2
hi,
i want to create forget password through coding without using forget password control.could you please help me how to do this through mail by using user email or username

sankarreddy


Responses

Posted by: Blessyjees on: 2/28/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Refer this link to send mail http://www.codeproject.com/Articles/12511/Send-Email-in-ASP-Net-2-0-Feed-back-Form

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

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

Posted by: Pradeepkumar417 on: 2/28/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

The following code sample shows how to sent forget password by mail

using System.Data.SqlClient;

using System.Net.Mail;
using System.Net.Mime;

protected void Button1_Click(object sender, EventArgs e)
{
ob.get_username = TextBox1.Text;
DataSet ds = us.password_fetch();
if (ds.Tables[0].Rows.Count != 0)
{
Label1.Text = ds.Tables[0].Rows[0]["username"].ToString();
Label2.Text = ds.Tables[0].Rows[0]["password"].ToString();
Label3.Text = ds.Tables[0].Rows[0]["mailid"].ToString();
}
try
{
SmtpClient smpclient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromaddress = new MailAddress("aaa@aaa.com", "");
smpclient.Host = "hostname";
smpclient.Port = 25;
message.From = fromaddress;
message.To.Add(TextBox2.Text);
message.Subject = "Retrieve Your Password";
message.IsBodyHtml = true; ;
string body = ("username=" + Label1.Text + " " + "password=" + Label2.Text + " " + "mailid=" + Label3.Text + " ");
message.Body = body;

smpclient.Send(message);
ScriptManager.RegisterStartupScript(this, this.GetType(), "dg", "", false);
}
catch (SmtpException ex)
{

}
}
catch (Exception ex)
{ }

}



Thanks & Regards,
Software Engineer,
Pradeep Kumar

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

Login to post response