Forget password by an user and sending password to his mail

Posted by Professionalhima under ASP.NET on 4/22/2012 | Points: 10 | Views : 1068 | Status : [Member] | Replies : 3
hi!
i'm M Himaja.
I'm presently undergoing training in TCS for .net stream.
In my project i have strucked with a problem of forget password.
when a user forgets his password and types his email id,server should
check if the email id was in database or not.if yes then automatically
his password has to be send to his email id ,if no a labels should be
displayed showing emailid is not in our database
Please help me in regarding this




Responses

Posted by: Ajayk3 on: 4/23/2012 [Member] Starter | Points: 25

Up
0
Down
It is very simple.

First create a function which send email to the specified user like

public void SendMail(string username)
{
//search in google for sending email to the user. You need to change the smtp port and other settings( you can ask these from admin)
}

Now create a SP which will return 0 or 1 [0 means user not exists into database and 1 means exists)

Create procedure spGetUserExists(@UserName varchar(100))
AS
BEGIN
IF EXISTS(Select 1 from usertable where username=@UserName)
select 1
else
select 0
END [You can change according to your requirement]

Now call this sp and pass username as a sql parameter.

If it returns 0 then show label
else call the function created above






Professionalhima, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Professionalhima on: 4/23/2012 [Member] Starter | Points: 25

Up
0
Down
can u please give me detailed description along with code,screen shots? please

Professionalhima, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/24/2012 [Member] Starter | Points: 25

Up
0
Down
Function CheckEmail(emailid)


if isemail(emailid) then

Dim mail As New MailMessage

mail.From = New MailAddress("From Address")

mail.To.Add("To Address")

mail.Subject = "Your Subject"

mail.Body ="Your Mail Body that is password"

Dim smtp As New SmtpClient

smtp.Host = <"Host Ip Address">

smtp.Port = <your port number>

smtp.Send(mail)

else

msgbox("No email Id found")

end if


____________
www.flickr.com/photos/psdesigner/

Professionalhima, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response