Completing the Login ASP

 

Introduction.  Compared to what we've just done, completing the Login ASP will be relatively simple.  Remember we had the 
  • Login.asp which was our form creation page which we will modify to be LoginReal.asp.
  • Members.html which was our redirect page.

Now we also need to develop a

  • Validation.asp to work as our form processing script page.

This will determine whether or not the user is actually a member based on the password they enter.

So now you need to modify the Login.asp so that it looks like the following and save it as LoginReal.asp.  You may also want to put these in their own directory on your hard drive.

<HTML>
<FORM METHOD=POST ACTION="Validation.asp">
<P>We need you to enter your member password <BR>in order to access the members pages.

<P>What is your member password?
<INPUT TYPE=TEXT NAME=txtPassWord>

<P>
<INPUT TYPE=SUBMIT VALUE="Submit PassWord">
</FORM>
</HTML>

The Members.html can stay the same as

<HTML>
<BODY>
Well let someone else get near you!
<BR>
You're definitely a member.
</BODY>
</HTML>

Finally, the Validation.asp will involve using the Response and Request classes.  You should develop the following Validation.asp.

<%@ Language=VBScript %>
<% Option Explicit %>

<HTML>
<BODY>

<%
Dim strRealPass, strEnteredPass
strRealPass = "kilroy22"
strEnteredPass = Request.Form("txtPassWord")
If (strEnteredPass = strRealPass) Then

Response.Redirect "Members.html"

Else

Response.Write "Invalid Password!" & "<BR>"
Response.Write "You must be a registered member!"

End If
%>

<P><A HREF="LoginReal.asp">Try to login again!</A>


</BODY>
</HTML>

Now you should upload these three files to your root web and try them out.  I have included images of the three pages below.  The first is the LoginReal.asp.

 

 

Now if you submit this with the correct password, kilroy22, then you should get the following page.

 

 

Finally, if you enter an incorrect password you should get the following web page.

 

 

At which point you can click on the hyperlink to take you back to the Login page.  You could also have the program redirect you directly back to LoginReal.asp.

As you can see, developing a functioning Login ASP is nontrivial though certainly not insurmountable.

Password Textboxes.  Finally you want to change the type of text box to a password textbox so that you can type in the password without anyone else seeing what you type.  The only thing you need to do is modify the line

<INPUT TYPE=Password NAME=txtPassWord>

so that you the textbox in the form page so that it is of the password type.