Hi dear friends ,
I want to create a password recovery page where i can ask for the users email id check if the email id exists in database and send the password or link to change password to the given email id...
Can u plzz help me out how can i do this..
Loading
Pankaj GogoiPosted Jun 18, 2011, 4:32 AM
You must have gone through all the articles provided by the members. I would also like to add some point and this may be relevant to you.
For password recovery, usually a link is sent to the user like this. Here userid query string value is the value that is generated when the user requested for password recovery. This value is in encrypted form and would be available in the database for a limited period of time, else the user may click on this link after a month or so to reset the password and you don't want that to happen.
"http://www.yoursite.com/passwordresetpage.aspx/userid=9wjkjswei--==swwo"
When the user clicks on this link in their mail, it will redirected to this page. In your page you would retrieve the querystring value and compare it with the database whether it is the same key value that is generated for this user ID email, if yes then present the user the password reset page else prompt the user a message or redirect to an unauthorized page.
Hope I am able to explain.
Thank You
Sam HobbsPosted Jun 17, 2011, 4:15 PM
For plain-text format an URL can be put in the text directly; the same as if you were to use plain text like in Notepad.
If you want to send a link that looks like a link in a web page, you must use HTML for the message. Then you format the message using HTML and the URL would be formatted as a link (an "A" tag).
Rohatash KumarPosted Jun 17, 2011, 3:22 AM
Hi Savitha,
Create Table
Now create a table in a SQL Server database with user name, user password and email fields. The table looks like this.
create table tab
(
userName varchar(20) not null,
userPassword varchar(20),
Email varchar(100)
)
Now enter some values into the table.
insert into tab values('Rohatash','roh','[email protected]');
go
insert into tab values('monu','mohan','[email protected]');
go
insert into tab values('satendra','satya','[email protected]');
Now using select statement.
select * from tab;
Create stored procedure
Now create a stored procedure for tab table. That means user password and usename will be retrieved from the table using the stored procedure. The stored procedure looks like:
create procedure retriveUserPass
@email varchar(20)
as
begin
select username,userPassword from tab where userName=@email
end
Create a form in ASP.Net for retrieving the usernameand userpassword. taking a textbox and two button control and a label control on the form.
Button1- Get Password
Button2- Get username
Code in c#
Now double click on the button1 to get Password.
string strcon = "Data Source=.;uid=sa;pwd=Password$2;database=master";
SqlConnection con = new SqlConnection(strcon);
SqlCommand com = new SqlCommand("retriveUserPass ", con);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@email", TextBoxemail.Text);
com.Parameters.Add(p1);
con.Open();
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
Label1.Text = "Password is: " + dr[0].ToString();
}
else
{
Label1.Text ="email does not exist";
}
con.Close();
Now double-click on the button2 to get user name.
string strcon = "Data Source=.;uid=sa;pwd=Password$2;database=master";
SqlConnection con = new SqlConnection(strcon);
SqlCommand com = new SqlCommand("retriveUserPass ", con);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@email", TextBoxemail.Text);
com.Parameters.Add(p1);
con.Open();
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
Label1.Text ="username is: " + dr[1].ToString();
}
else
{
Label1.Text = "email does not exist.";
}
con.Close();
Abhimanyu K VatsaPosted Jun 17, 2011, 1:54 AM
probably this method will go like this..
to resent password using url user must need one information (username or emaild).
(i) if he only know username then send the email containing unique url and display him email on you site.
(ii) if he only know email id then ask him and send the email containing unique url.
(iii) in email send url something like
http://www.domain.com/forgetpass/ResetForgottenPass.aspx?uniqueQueary
(iv) when the user click the link http://www.domain.com/forgetpass/ResetForgottenPass.aspx?uniqueQueary display 2 text-boxes and ask the new password there
(v) if you submit then send one more email and ask for verification
(vi) if verification for new password is successful then activate that account for user
(vii) remember to generate uniqueQuery in such a way that can't be guessed (it would be nice if that url will be active for 30 min), this will add more security
hope this helps
Savita JoshiPosted Jun 17, 2011, 12:49 AM
Ya exactly i want to check first if the user has provided correct email id and then send a link to reset their password instead of sending directly the password... How to send links ? plzz can someone provide a sample...
Plzz note i am not using the login controls provided by the asp.net..Not using roles and membership
Abhimanyu K VatsaPosted Jun 16, 2011, 2:10 AM
when email is known then sends the email containing password recovery procedures etc.
when username is known then display the email id which has matching username and then send the mail containing password recovery procedures. (note: this is not successful method, by asking username and displaying its email id + sending email).
ok, let's assume, user know the email id and wishing to recover the password. for this user will provide the email id and system will send the mail, please note here this mail may have either recovery url or direct the password. here both techniques are mostly used.
The url provided by Jagan above sends the password directly to email id. you may develop sending url and then recover it method too.
in addition with above all try this too
(i)
Jiteendra SampathiraoPosted Jun 16, 2011, 12:31 AM
When the user enter email id and clicks submit button...you should fetch the database record from the table which depends on email_id.
After checking the validations and all( if User given email id matches with email id in database). Get the txtemail.text value and store it as a string....
Ex: string strTo = txtemail.Text;
See the rar files code behind....you will get the idea...
Savita JoshiPosted Jun 16, 2011, 12:07 AM
I do not want to change the password.. My question is about password recovery if the user has forgotten his password. I want to send a link to reset the password to the registered users email id. If that email exists in that database and is valid i want to send the link to them to reset their password..That is my requirement and also how do i make the SMTP setting and where do i set it
Sam HobbsPosted Jun 15, 2011, 4:57 PM
I know that you are only asking for help sending a message. There are articles in this web site, as others have already said. Read the relevant articles and then when you have specific questions the people here will be eager to help.
Jaganathan BantheswaranPosted Jun 15, 2011, 12:36 PM
Read this http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/7255/
Abhimanyu K VatsaPosted Jun 14, 2011, 2:31 AM
Do you think, searching any particular password information from database not requires query to execute?
There is no way, you must need some query which will search the record and then sends (emails) the password or temporary password recovery url.
Jiteendra SampathiraoPosted Jun 14, 2011, 1:53 AM
http://www.c-sharpcorner.com/UploadFile/anjudidi/EmailSend10132009022448AM/EmailSend.aspx
Savita JoshiPosted Jun 14, 2011, 1:27 AM
I dont want to database query.. I want to know how to send email with a link to the user...
Jiteendra SampathiraoPosted Jun 14, 2011, 1:08 AM
Create a table in database and create the columns like user_name,password,email_id , contact_number etc.
When you creating the user account accept the all information and store it in the database table.
When user clicks Forget password.. It goes to the other page like forgetpwd.aspx page there you have to accept the email id from the user.
When the user enter email id and clicks submit button...you should fetch the database record from the table which depends on email_id.
Query will be like this:
Select user_name , password from XYZ table where email_id= '[email protected]'
And send the mail using SMTP server.....
Refer this article: Click Here (how to send a mail)
Hope it help you......
Savita JoshiPosted Jun 14, 2011, 1:05 AM
U have not read my question properly.. I am asking how to send email to the user after getting their email id.. I want to send the password or a link to change the password to their email id.. how to do that..
Jaganathan BantheswaranPosted Jun 14, 2011, 12:52 AM
What is your problem here..
As you said you can create a password recovery page and ask email id of user and sent reset page link to that mail. thats it right.