Pin Me

How to Password Protect a Web Page with Dreamweaver

written by: N Nayab•edited by: Amber Neely•updated: 8/18/2010

Have you ever wondered how to password protect a web page? Dreamweaver UltraDev makes it possible to restrict access of certain or all pages on a website to registered users. This article will teach you how to password protect a web page with Dreamweaver.

  • slide 1 of 4

    User Registration

    Password protection of a webpage comes after creating and saving webpages.

    The first step towards password protect web pages in Dreamweaver is creating a user registration page. This includes the following steps:

    1. Create a database to store user details. Two mandatory columns in the database table are name and password. An access privilege column is optional. Providing all users with the same password simply requires configuring the database application to enter the password in each new user record by default. Ensure that the database is connected using the insert record option in the menu.
    2. Create a new page in Macromedia Dreamweaver (File > New) and insert a HTML form (Insert > Form) at the required area in the page. Add text fields (Insert > Form Objects > Text Field) to collect the username, password any other detail. Each unit of information requires creation of a separate text field.
    3. Update the database table by setting the Insert Record Option (Window > Server Behavior> Insert Record). Identify the HTML form used to obtain the username and password in the Get Values pop-up menu (Connections > Insert Into Table > Get Values) menu.
    4. Select User Authentication > Check New Username from the pop up menu (Connections > Insert Into Values > Get Values) validate whether the entered username or password is unique. If username already exist, the server behavior cancels the insert record operation and opens a new page.

    Repeat Steps 2, 3 and 4 for each object or unit of information. For instance, this process needs completed once for username, and again for the password.

    To restrict access to a single user or to a closed group without users having to register, create a database table with username and password, and enter values directly into the table instead of steps 2, 3, and 4. Communicate the assigned username and password to the users, allowing them to log in directly.

  • slide 2 of 4

    User Log In

    Dreamweaver Tutorial Password Protection The second step to password protect web page Dreamweaver is to create a login page.

    1. Create a new login page (File > New)
    2. Add a HTML form to this new page (Insert > Form)
    3. Add text fields (Insert > Form Objects > Text Field) to collect the user’s name, password any other detail. Each unit of information requires creation of a separate text field. To mask the entered password, open Property Inspector (Window > Properties), and check the Password radio button. This displays the entered password character as asterisk (*.)
    4. Add a Submit button to the form (Insert > Form Objects > Button). To change the label of this button to “Log In," “Enter," or any other message, open the Property inspector (Window > Properties), and enter a new value in the Label box.
    5. Add a Log In User Server Behavior to validate the entered username and password. Select Window > Server Behaviors > User Authentication > Log In User. Specify the form and form object from where to collect the user input, and the database table and database column that store details of registered users. Also specify the page to open if the user values match with values in the database, and the page to open if the user values do not match.

    The Log In User Server Behavior compares the values entered by the user against the values for registered users in the database table, and opens the specified page if the values match.

  • slide 3 of 4

    Activate Restrict Access to Page

    Dreamweaver Tutorial Password Protection Finally, add the Restrict Access to Page Server Behavior (Select Window > Server Behaviors) to the webpage. This ensures that the page becomes accessible only through the log in, and cause redirection to another page when users try to bypassing the login page and type the page URL directly in the browser.

    The above process restricts access to the specific web page. To extend the same access restriction to the entire website, or multiple pages, copy and paste the access rights from one page to another using the “Copy" and “Paste" commands in the Windows > Server Behavior menu.

  • slide 4 of 4


    Varese, Jon Michael. Password Protecting Pages. Macromedia Dreamweaver UltraDev Support Center.