Thursday 6 March 2014

Refleksi Minggu ke-4

Alhamdulillah..for the 4th week in authoring class, we were introduced a server-side scripting called ASP (Active Server Pages). ASP enables us to make dynamic and interactive web pages

Before we continue with the explanation of ASP language scripting, let's differentiate between PHP and ASP.

ASP (Active Server Pages) :

  • Operating System : Windows
  • Testing Server : Internet Information Services (IIS)
  • Database : Microsoft Access (can't manage and handle huge-size of databases)
  • cannot be run by simply opening the page in a web browser, but must be requested through a web server that supports ASP.
  • Loading speed slower than PHP because ASP uses an overhead server and uses a COM based architecture
PHP (HyperText Preprocessor) :
  • Operating System : Linux, Windows, Solaris
  • Testing Server : Apache - not cost a thing
  • Database : MySQL (can manage and handle huge-size of databases) - not cost a thing
  • HTML-embedded scripting language
  • Much of the syntax is borrowed C, Java and Perl (benefit for C++ programmer)
  • much more flexible when connect to several databases.
  • Loading speed much quicker than ASP because it runs in its very own memory space.
Before we proceed for using ASP Script, we have to install web server of ASP called IIS. So, how to install IIS for Windows 8?

Steps to install IIS :

kredit : youtube


If we succeed to launch IIS, then the web server can be used to run ASP pages.

Let us create an ASP page including database created in Microsoft Access. Below are the steps to create a simple Guestbook page.

Create an ASP Page (Guestbook)

  1. Defining an ASP site in Dreamweaver CS6 (change permission setting)
  2. Set up a site (eg. C:\inetpub\wwwroot\Guestbook)
  3. Create a database and save in folder data (eg. C:\inetpub\wwwroot\data\data.mdb)
  4. Create a connection string between ASP page and database (eg. C:\inetpub\wwwroot\Guestbook\Connections\dmx.asp)
  5. Create an ASP page and insert form as created in database (Microsoft Access) as well. (eg. C:\inetpub\wwwroot\Guestbook\guest.asp)
  6. Create another ASP page to view all the data entered (C:\inetpub\wwwroot\Guestbook\view.asp)
--------------------------------------------------------------------------
1. Defining an ASP site in Dreamweaver CS6

ASP is a server-side technology, so all your web pages need to be in the IIS server document root for the dynamic code to be processed. The IIS document root is located at C:\inetpub\wwwroot. It's necessary for you to have the permission to create new files and folders inside the wwwroot folder. IIS also needs read and write permissions to display and update records in an Access database.

Changing permissions for the server document root

  1. Use Windows Explorer to locate wwwroot, and try to create a new folder called asp_test inside it. If permission is denied, you need to follow all these instructions. Otherwise, only the first few steps are necessary.
  2. Right-click the wwwroot folder, and select Properties from the context menu.
  3. Select the Security tab, and click Edit.
  4. In the Group Or User Names section at the top of the panel, select IIS_IUSRS, and select the Allow check box for the Write permission in the lower half of the panel (see Figure 4).

Select the Write permission for IIS.
Figure 4. Select the Write permission for IIS.

  1. If you were able to create the asp_test folder before, click OK twice to close the Permissions and Properties panels. You can proceed immediately to the next section, Setting up the site definition.
  2. If you want all users to have permission to create files and folders in the server root, select Users from the Group Or User Names section in the top half of the Permissions panel, and select the Allow check box for the Write permission.
  3. If you want to be more selective with whom you allow to write to the server root, click the Add button to create a new entry for a single user or group of users.
  4. In the panel that opens, type the name of the user(s) in the following format: COMPUTER_NAME\Name. For example, my Windows 7 computer is called DAVID7, and my username is David, so I typed DAVID7\David.
  5. Click Check Names to make sure you have typed the name(s) correctly. If the name is valid, Windows underlines it (see Figure 5).

Create a separate user category for permissions.
Figure 5. Create a separate user category for permissions.

  1. Click OK to close the panel, and then select the new user in the Permissions panel, and select the Allow check box for the Write permission.
  2. Close both the Permissions and Properties panels by clicking OK.
  3. Check that the permissions have been updated by creating a new folder in the server document root atC:\inetpub\wwwroot\asp_test.

--------------------------------------------------------

2.   Set up a site (eg. C:\inetpub\wwwroot\Guestbook)
Once you have installed IIS and made sure you can write to the server document root, you're ready to start Dreamweaver and define your ASP site.



  1. Select Site > New Site.
  2. In the Site Setup dialog box (see Figure 6), type a name for the site in the Site Name text box, and click the Browse for Folder icon to the right of the Local Site Folder text box. Navigate to C:\inetpub\wwwroot\asp_test, and select it.
  1. This is all that's necessary to create an ASP site until you want to do some testing, but since you're going to test the site straight away, select Servers in the column on the left of the Site Setup dialog box.
  2. Click the plus (+) button at the bottom left of the dialog box to add a new server.
  3. In the dialog box that opens, make sure that the Basic button is selected, and select Local/Network from the Connect Using list.
  4. Give the server a name, such as Local Testing.
  5. Set the value of the Server Folder text box to the same as Local Site Folder–in this case,C:\inetpub\wwwroot\Guestbook
  6. The value of Web URL is what you would enter in the address bar of a browser to reach the server folder. In an ASP site, the URL to reach c:\inetpub\wwwroot is http://localhost/, so to use the asp_test folder, you need to typehttp://localhost/asp_test as the Web URL (see Figure 7).
Set the basic options for the testing server.
Figure 7. Set the basic options for the testing server.
  1. Select the Advanced button at the top of the dialog box. This reveals the options for both a remote server and a testing server.
  2. Set the Server Model in the Testing Server section to ASP VBScript (see Figure 8).
Set the Server Model option to ASP VBScript.
Figure 8. Set the Server Model option to ASP VBScript.
Note: The Server Model setting also has options for ASP JavaScript, ASP.NET C#, and ASP.NET VB. However, ASP VBScript is the only version of ASP for which Dreamweaver CS5 supports automatic code generation through server behaviors and recordsets.
  1. Click Save.
  2. This is a testing server, so make sure the Testing check box is selected. If necessary, deselect the Remote check box (see Figure 9).
Ensure that the Testing checkbox is selected.
Figure 9. Ensure that the Testing check box is selected.

  1. Click Save to save the changes you have made.
-------------------------------------------------------------------

3. Create a database and save in folder data (eg. C:\inetpub\wwwroot\data\dataguest.mdb)
  1. Use Microsoft Access to create a database.
  2. Choose Blank Access Database.
  3. Create fields in the table eg. surname, firstname, email, website and message.
  4. Save and publish as dataguest.mdb



4. Create a connection string between ASP page and database (eg. C:\inetpub\wwwroot\Guestbook\Connections\dmx.asp)
  1. Use Dreamweaver to create a connection string.
  2. Choose Blank ASP VBScript
  3. On database windows, click + > Custom Connection String
  4. Fill the name of the connection (eg. conguest)
  5. Fill the script of ASP connection string
  6. Choose Driver on Testing Server
  7. Test
  8. Hopefully your connection is completely success. 


If the connection was not succeed, might be your  64-bit windows settings should be changed.

Enabling connection to an Access database on 64-bit Windows

The Microsoft Access Driver is not available in a 64-bit version, so you need to use the 32-bit driver.
  1. Launch the Internet Information Services Manager by selecting Start > Control Panel > Administrative Tools > Internet Information Services (IIS) Manager.
  2. In the Connections panel, select Application Pools, and select DefaultAppPool in the center panel.
  3. In the Actions panel on the right, click the Advanced Settings link.
  4. In the General section, set Enable 32-Bit Applications to True (see Figure 13), and click OK.
Enable 32-bit applications in the IIS Manager.

5. Create an ASP page and insert form as created in database (Microsoft Access) as well. (eg. C:\inetpub\wwwroot\Guestbook\guest.asp)


  1. Create a form using text field and button. Click Insert > Form



2.  Click Server Behaviour > Insert Record





6. Create another ASP page to view all the data entered (C:\inetpub\wwwroot\Guestbook\view.asp)
  1. Create a page to view data from a database using Recordset
  2. Click Server Behaviour > Recordset (Query)

Hope you enjoy creating an ASP page!!!

No comments:

Post a Comment