eHow launches Android app: Get the best of eHow on the go.

How To

How to Create a Login Page in ASP

Contributor
By Robert Karr
eHow Contributing Writer
(0 Ratings)

Login pages using ASP (Active Server Pages) run a small script to verify a remote user's identity. The process requires two types of files, an HTML page, and an ASP script. You can write a simple ASP login using Notepad or another text editor to understand the process. In reality, you would link the ASP file to either a remote database or cookies already stored on the user's computer by substituting the correct path for the "action" in Step 1 below. The latter process involves your specific server and user database setup, which goes beyond a general scope.

Difficulty: Moderate
Instructions
  1. Step 1

    Create the HTML page first by opening Notepad or another text editor. Type the following code exactly as it appears on separate lines. When done, save it with the name Login_Page.html (deleting the automatic txt extension).

    <html>
    <head>
    <body>
    <form id="LOGIN" name="LOGIN" method="post" action="ASP_LOGIN.asp">
    <table align="left" cellpadding="5" cellspacing="0" border="2">
    <tr>
    <td>UserID</td>
    <td><input type="text" name="UserID" /></td>
    </tr>
    <tr>
    <td>Password</td>
    <td><input type="password" name="Password" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><label>
    <input type="submit" name="Password" id="Password" value="Login">
    </label></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  2. Step 2

    Create the ASP file in a new Notepad file with the following code lines. Give this file the name "ASP_Login.asp" and save it.

    <%
    Dim UserID
    Dim Password
    Dim AuthUser
    Dim AuthPassword
    UserID=Request.form("UserID")
    Password=Request.form("Password")
    AuthUser="Me"
    AuthPassword="Eureka"
    If UserID<>AuthUser then
    Response.write("You have failed to enter a correct UserID and/or Password. Press the Back key on your browser to try again.")
    else
    Response.write("You have successfully logged in. Congratulations.")
    end if
    %>

  3. Step 3

    Upload both files to your website. Use a browser to land on the "Login.html" page. First, input a random UserID and Password. You should then see the error message in Step 2. If you do not, then recheck the code for both files.

  4. Step 4

    Test the Login by going back to the HTMLl page and refreshing it. Enter "Me" for the UserID and "Eureka" as a password. Now you should see the congratulatory confirmation in Step 2. If you do not, then recheck the coding as above.

Tips & Warnings
  • ASP is old technology. Microsoft released ASP.NET 1.0 in January 2002, and the current version is 3.5. The new version includes a visual control for creating login pages, including easy ways to allow a user to create a user name and password.
  • Any time you open a way for a remote user to interact with information on your server, you increase the security risks. Even simple login pages should include some elementary steps to prevent compromise.
  • Both HTML and ASP coding requires strict adherence to the format and wording. The slightest deviation can cause the project to fail.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Tags
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

eHow Computers
eHow_eHow Technology and Electronics