When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Product Manager, Testing (PA)
Next Step Systems
US-PA-Wayne

Justtechjobs.com Post A Job | Post A Resume

Published: Sunday, April 30, 2000

Emailing Users their Forgotten Passwords
By Eric Coffman


A few months ago I decided it was time to learn ASP. I started out using some code samples from around the web, and eventually learned to write some of it myself. I recently read Sams Teach Yourself Active Server Pages 3.0 in 21 Days which helped me clean up my coding techniques.

- continued -

I work at a large university that has many online courses. Due to the creation time involved in preparing an entire course for the net, and to keep others from plagiarizing the material, we password protect much of the content. We use an access database to keep all students names, email addresses, usernames, and passwords that are enrolled in the particular class and have them log in to the the courses with that information. Although this method works quite well to allow only the members of a particular class access to the course material, the students, especially at the start of a semester, often forget their login information. Last semester I decided it was time to stop the "I forgot my password" emails, and wrote this script.

I use the CDONTS component that comes with IIS to do the sending. (For a good article on CDONTS, check out: Sending Email Using CDONTS.) Basically what happens is a person who has forgotten their login information is directed to a page that asks for their email address. The page posts the entered email address to a second page which checks if the email address entered is in the database. If the email address is not there, the user will be prompted as such. If the email address is there, the script sends an email to the address entered with the username and password for that person in the message body. We assume that your user database has a username, password, and an email field and the database table is called USERS. Now that we know what we are doing lets see how.

The first page, forgot.asp is just a basic form that gathers a users email address and posts it to sendit.asp. Keep in mind there is no error checking here, you may want to add that to avoid apostrophe problems.

<html>
<head>
  <title>Forgot Password?</title>
</head>
<body>
If you forgot your login information, enter you email
address below and it will be sent to you.

<form method="POST" action="sendit.asp">
  Your email address:
  <input type="text" name="email" size="20">
  <input type="submit" value="Request information">
</form>
</body>
</html>

The second page, sendit.asp is what actually does the work. We'll look at the source code for SendIt.asp in detail in Part 2.

  • Read Part 2


    Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article