Before
implement this first design one table UserInfo
in your database like as shown below

Column Name

Data Type

Allow Nulls

UserId

int
(Set Identity=true)

No

UserName

varchar(50)

Yes

Email

varchar(125)

Yes

Location

varchar(50)

Yes

Once
table design complete enter some dummy for our example like as shown below

UserInfo

Now
we are going to use our gmail account credentials to send mail for that first
you need to enable POP enable option in your Gmail account for that you need to
open your gmail account and go to Settings-->Forwarding and
POP/IMAP

After that design your aspx page
like this

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Code to recover forgot password in asp.net using C# and
VB.NET</title>

Sir, My final B.Tech Final Year Project is "Mailing Website like Gmail" obiviously it will going to be a milestone in myproject but sir please guide me on how we send and receive mails if we have our own domain name like "abhinavsingh993@richmail.com" where rich mail is my domain name....Please....Please guide me on that ........now as usual you are simply great and hats off to your dedication and curiosity to explain ASP.NET at the end I am eagerly waiting for your next post....thank you sir

This code cannot be used in real life due to security (Sql Injection) and maintenance (Values that could be changed like connectionstring, smtp etc). For the people that could copy this code should bear this in mind.

it seems that this article is written by a beginner, this should not be implement in real project. i just post some ideas. 1. store a unique key (salted or hash or encrypted) in database table while creating a user. 2. send an email link to the user login Email while submitting forgot password request. for example http://www.domain.com/forgotpassword/key/acbd234sxw3y3. confirm the link from user by clicking the link 4. match the link key with the stored key in database user table 5. show to reset password page.