2001 Conference Proceedings, June 11-14, 2001

Creating a fully-functional stand-alone web development system that includes web and database servers

Robin Snyder
Department of Computer Science and Quantitative Methods
Winthrop University
701 Oakland Avenue
Rock Hill, SC 29733
(803) 323-4813
snyderr@winthrop.edu
http://faculty.winthrop.edu/snyderr

Abstract

There are times when it is useful to be able to develop and test a web-based system that includes server-side web and database processing without being connected to the Internet. This paper/talk will discuss/show how to create a fully-functional stand-alone web development system on a laptop computer that includes the following: Microsoft Internet Explorer, FrontPage, Personal Web Server supporting Active Server Pages, and Access or SQL Server database system accessed via ActiveX Data Objects. The required background in TCP/IP will be included as will the necessary steps to acquiring, installing, and configuring the various components. The author uses such a system for classroom presentations, which works even if the local network and/or Internet is not working in the classroom.

Introduction

In 1995, the author started using static HTML pages on a stand-alone computer and publishing them to the Internet for students. In 1997, the author started using JavaScript in to add client-side processing to the web system. Early in 2000, the author started using Personal Web Server (free with Windows 98) and Active Server Pages to add server-side processing to the web system. By the end of 2000, the author had begun integrating database access via SQL Server into the web system.

The web system on the web server that your audience sees is the production system. In the case of a professor, one audience might be students in the classes that the professor is teaching. In the case of a business, the primary audience might be customers who purchase items from the business. However, it is not good to directly develop content on the production system, for a number of reasons all of which are somewhat related.

  1. You might make a mistake, either in content or in format, that could have serious consequences, especially if security is inadvertently modified.
  2. You might want a backup for the production system, in case you make an unintended change.
  3. You might change your mind. While making changes, the web system is left in a quasi-stable state.

For these and other similar reasons, it is best to develop web content off-line and then, when ready, publish that content from the development environment to the production environment.

Of course, there are times when the development server might need to function as a production server. For example, one time during Fall 2000, the author had students in a lab session connect to the author's laptop-based web development environment in order to get the lab assignment and to submit assignments electronically in lieu of using the University web system, which was down. The lab went on as usual, a result of both having a development environment and being able to make that environment available when the need arose.

The rest of this paper is a brief introduction of how such a development environment might be created.

Relocatable web systems

The most important design consideration for a dual development web system mirrored to a production web system is that the web system must be fully relocatable. This means the following.

  1. All links that refer to files within the web system must be relocatable file references and not absolute http: references.
  2. All pages with embedded server-side processing code must distinguish which web server the page is on and take appropriate action.

If these conditions are met, then it is a simple file copy, or FTP update, or HTTP update, from development to production system.

Basic Internet capability

A development environment can be created on any sufficiently powerful computer with the appropriate software, etc. It is assumed that the reader has used the Internet and has Internet access and capability and ability on the intended production and development environments to consist of the following capabilities.


  1. The development environment has a TCP/IP connection to the Internet (or intranet, if that is where the production server is located) via some ISP (Internet Service Provider). The reader knows how to access the Internet from the development environment.
  2. The development environment has a web browser connected to the Internet. The reader knows how to use a web browser.
  3. The development environment has software that can be used to create web pages. The reader knows how to use that software to create web pages and publish them to either the development or production server.
  4. An email connection that can be used to send and receive mail is on the development environment. The reader knows how to use email to send and receive messages. The development environment discussed only sends mail, but this capability must be provided via SMTP (Simple Mail Transfer Protocol) by the ISP. For this to be of use the production web system, the production web sever must support outgoing email capability. If not, this capability can be added to the production environment in the same way as to the development environment.


Although the general discussion that follows applies to any platform, for the purposes of this paper, the specific discussion applies to a platform that consists of the following.

  1. The operating system of the development and production web systems is Microsoft Windows 95/98/Me/NT/2000. Important differences between 95/98/Me and NT/2000 will be mentioned, where appropriate, although the paper is written towards a Windows 98 platform, the platform currently used for the development system.
  2. The web browser is MSIE (Microsoft Internet Explorer) 4.x, 5.x, etc., or some similar web browser used to access the WWW (World Wide Web).
  3. The system used to develop web pages is Microsoft FrontPage, Macromedia Dreamweaver, or some similar software to create web pages.

For the development environment discussed, the platform consists of the following.

  1. Microsoft Windows 98 running on a laptop computer. Because Windows 98 is not as secure an environment, it can often be moved into and between Windows 2000 environments easier than can a Windows 2000 laptop.
  2. Microsoft PWS (Personal Web Server) or personal IIS (Internet Information Server), free from Microsoft and/or included with Windows 98/Me/NT/2000. The production web server should be running full IIS. Note that Personal IIS on Windows 2000 includes SMTP and FTP capability, but that capability is not discussed here.
  3. Microsoft SQL Server 7 or 2000, free 120-day trial available from Microsoft or with selected textbooks, no time limit on the Developer edition, if you have it as part of a MSDN (Microsoft Developer Network) subscription.
  4. Persits ASPemail component, free for noncommercial use. The full version has some added features, but the free version is very useful for most purposes. For space reasons, this topic is not discussed further in this paper.
  5. Command-line FTP (File Transfer Program), included with Microsoft Windows, or update via http: using Microsoft FrontPage and web server FrontPage support. Updating the web site is not discussed further in this paper.


Finally, each of the many topics discussed in this paper can fill a large-sized book. Thus, only the briefest examples will be given on how to actually use the capability provided by each system. Instead, the needed information for installing and setting up each system is the primary focus. Some references used by the author to install and setup each system have been included at the end of this paper. In addition, web searches are very useful in finding tips on using each of the described software systems.

TCP/IP

TCP/IP is the protocol of the Internet and any intranet that you might be using. The use of PWS as web server and SQL Server as database server require that TCP/IP be installed and that you know the name of the development computer and be able to determine your IP Address. The standard intranet IP addresses are as follows.



10.x.x.x (class A)

172.16.x.x (class B)

192.168.1.x (class C)

These addresses cannot be part of the Internet but may be connected through a router that uses NAT (Network Address Translation).

One way to determine the IP address, and other TCP/IP settings on the computer, go to the command line (one way is to select "Start", "Run", type "command", and press Enter. Then, type the command

ipconfig /ALL

and press Enter. Another way, on Windows 95/98/Me, is to select "Start", "Run", type winipcfg.exe, and press Enter.

One way to determine and/or set the name of a computer, is to select "Start", "Settings", "Control Panel", "Network". The "Network" dialog box appears. Select the "Identification" tab. Under "Computer name:", you can set the name of the computer which is, in this case, rmsnyder. All computers that wish to share files need to have the same "Workgroup:" name. The default workgroup name is WORKGROUP, although the author has found that it is best to name the home network workgroup the same as the work network workgroup name. Currently, that workgroup is WIN. Otherwise, one must constantly change the workgroup name and either reboot or logoff and log back in order to change workgroup names.

HTTP protocol

To understand what is happening during a web transaction, one must understand the basic http: protocol. A typical web page transaction goes as follows.

  1. The client initiates the transaction by opening a connection to the server and requesting a web page from a server.
  2. The server receives the request, processes the request, often via server-side processing involving database access, sends a response, and closes the connection.
  3. The client receives the response, formats the response, and displays it to the user.

This protocol is stateless in that no memory is kept of previous transactions with this client. To remember previous client transactions, the concept of cookies were introduced, with all the inherent and well-publicized advantages and disadvantages.

Client-side versus server-side processing

Web pages consist of text files in a particular format. Static HTML (Hypertext Markup Language) pages, except for perhaps an animated .gif file, have a file extension of .htm (or .html) and consist of plain HTML that is formatted and displayed by the client browser.

Client-side processing involves a client-side scripting language, such as JavaScript, that allows dynamic content to be displayed by the browser at the client computer. The primary problems with client-side scripting languages are as follows.


  1. There is no protection of source-code from prying eyes.
  2. The client-side scripting code must account for variations in a large number of possible client browsers.

Because of these problems, most client-side processing is done with the fairly portable JavaScript using a small subset of the capabilities of the language, again for portability reasons.

Server side processing was developed both to solve some of the problems with client-side processing and to provide support for e-commerce and other applications requiring server-side database access. It is a major security problem to allow the client to directly access the database. Thus, the web server acts as a go-between between the client browser and the database server. A common form of server-side processing is Microsoft Active Server Pages.

Microsoft ASP (see, for example, [2], [10]) is a application framework for adding server-side processing to web pages. Although in theory any scripting language can be used that has been adapted to this framework, in practice VBScript, a subset of Visual Basic and using Visual Basic syntax, is most often used. Other alternatives, not as well supported, include Microsoft JScript (a version of JavaScript) and PERL.

To see how ASP works, consider the following HTML that, when formatted, displays three numbered successive lines of "Hello, World" text.

<HTML>

<HEAD>

</HEAD>

<BODY>

<BR> 1. Hello, World

<BR> 2. Hello, World

<BR> 3. Hello, World

</BODY>

</HTML>

The output on the screen would appear as follows.

1. Hello, World

2. Hello, World

3. Hello, World

The following ASP file, when formatted, sends the same HTML to the client browser.

<%@ LANGUAGE="VBSCRIPT" %>

<HTML>

<HEAD>

</HEAD>

<BODY>

<% Dim i %>

<% For i = 1 To 3 %>

<BR><%= i %>. Hello, World

<% Next %>

</BODY>

</HTML>

Note the following.



  1. The ASP language used is "VBScript".
  2. Each ASP statement starts with a "<%" and ends with a "%>".
  3. Variable i, declared using a Dim statement is used in a For loop from 1 to 3 to output successive lines.
  4. An expression to be output, such as i, can be placed between a "<%=" and a "%>".

It should be obvious that ASP provides considerable flexibility is dynamically creating web pages. In addition, ASP scripts have access to any ActiveX/OLE/COM object that is available on the web server. One such useful component is the ADO (ActiveX Data Objects) component, used by ASP pages to access database servers such as SQL Server.

When using web page creation software such as FrontPage to develop static HTML pages or HTML pages with client-side processing, a "Preview" page shows what the page will look like. Unfortunately, if server-side processing is used, the "Preview" page is not very useful as a web server is needed to see the effect of the server-side processing. To see a change to the web system, one must save the page, switch to the web browser, and reload the page from the web server so that server-side processing is performed on the page. Microsoft Personal Web Server can be used as such a web server.

Personal Web Server

PWS (see, for example, [1], [9]) is not intended for production web server use since it handles only a low volume of transactions at any one time and by only a few concurrent users. In addition, secure web communication using SSL (Secure Sockets Layer) protocol using https: is not supported. Nevertheless, PWS can be very useful for getting a web server up and running and for testing a web site before publishing the web site to a production web server. PWS is included free with Windows 98/Me/NT/2000, and can be downloaded as part of the NT Option Pack (yes, that is what you need) for Windows 95. The method for installing PWS for Windows 98 is as follows. The other platforms are similar.


  1. Select "Start", "Settings", "Control Panel". The "Control Panel" dialog box appears.
  2. Select "Add/Remove Programs". The "Add/Remove Programs Properties" dialog box appears.
  3. Select the "Windows Setup" tab. The "Windows Setup" dialog box appears saying "Please wait while Setup searches for installed components...". You may have to wait 20 or 30 seconds.
  4. Under "Components", select "Internet Tools".
  5. Select "Details". The "Internet Tools" dialog box appears.
  6. Select "Personal Web Server", "OK". Follow the instructions.

If you wish to see the official installation instructions, select "Start", "Programs", "Internet Explorer" (the folder, not the program shortcut), "Personal Web Server". A web page is opened with installation instructions.

In my case, the "Transaction Server" did not fully install, but that did not seem to cause any problems. I am not sure why it did not install. It is required for IIS on NT/2000, but is not required for PWS, although the PWS setup will not let you install without trying to install it.

Once installed, you can access the settings from the icon in the tray. If PWS is not in the tray, you need to find the icon to start PSW and select "Properties" "Show Tray Icon". The "Personal Web Manager" dialog box appears. The "View" options of "Personal Web Manager" are as follows.


  1. The "Main" view is used to "Start" and "Stop" PSW and to display settings and statistics.
  2. The "Publish" view is used to quickly publish a web page that is available on your web site via PWS. We will be using FrontPage, so we will not be using this view.
  3. We will not need the "Web Site" view as we will be using FrontPage.
  4. The "Tour" view provides a tour of the capabilities of PWS.
  5. The "Advanced" view is used to set properties that determine where your web site is located on your hard drive.

The "Publish" and "Tour" options are pretty useless. But, before starting PWS, you should specify the virtual directory mappings to the local hard drive under the "Advanced" view.

  1. Under "Directory:", specify the directory on the local hard drive where your web site is to be placed. Note that a lot of subdirectories will be created here, so you might not want to specify a directory that contains other files.
  2. Under "Alias:", you can create an alias name for this directory, except for the "<Home>" directory.
  3. Access can be "Read", "Execute", and/or "Scripts". Usually, your web site that everyone can access is "Read" and "Scripts". Scripts can call programs on your hard drive in directories that should be set to "Execute".
  4. When done, select "OK".

Directories

A virtual directory is a directory that is specified relative to some fixed directory, while a physical directory is specified using an absolute path. For example, the first several virtual directories after a default install of PWS are as follows.

<Home>

/_private

/_vti_bin

/_vti_adm

/_vti_aut

/_vti_cnf

Specifying the root directory on the local hard drive as D:\G maps the above virtual directories to the following physical directories.

D:\G

D:\G:\_private

D:\G:\_vti_bin

D:\G:\_vri_bin\_vti_adm

D:\G:\_vri_bin\_vti_aut

D:\G:\_vti_cnf

Note that the virtual directories use the forward slash "/" while the Windows directories use the backslash "\". If your home page is available at http://rmsnyder, then the above virtual directories map to the following Internet directories.

http://rmsnyder/

http://rmsnyder/_private

http://rmsnyder/_vti_bin

http://rmsnyder/_vri_bin/_vti_adm

http://rmsnyder/_vri_bin/_vti_aut

http://rmsnyder/_vti_cnf

Notice that while there is only one virtual directory, there may be more than one physical directory. The home page location of http://rmsnyder is used because, in this case, the computer name is rmsnyder.

The location http://rmsnyder will work on an intranet running Windows and TCP/IP where both computers have the same workgroup name. On the Internet, however, you would need a valid domain name that maps to the IP address of your computer. This IP address would have to be a fixed IP address and not a dynamic IP address as used in many institutional and ISP environments. If one computer had an Internet IP address of 123.45.67.89, then another computer on the Internet could access the first computer using http://123.45.67.89. If the user legally registered the domain name mywebsite.com and had a fixed IP address, then a DNS (Domain Name System) server would be able to translate the name mywebsite.com to the proper IP address.

For example, on the author's laptop, the computer name is rmsnyder, the virtual directory name is W, the physical directory location is D:\W, and the default home page in the browser is set to http:\\rmsnyder\W. Since the default web page is default.asp, the physical default web page is D:\W\default.asp.

Advanced options

Under "Advanced options", check the box for "Enable Default Document". The "Default Document(s):" should be set to Default.htm,Default.asp so that the first one of these found in this directory will be the one loaded, if no file is otherwise specified.

Insure that the check box for "Allow Directory Browsing" is not checked. Allowing users to browse directories can make it easier for an intruder to breach the security of your web site, so do not check this box. Prohibiting directory browsing is like granting "Read" access but not "File Scan" access to a directory. Thus, a viewer can read any file desired in a directory, but cannot perform a directory listing to see what files are there. Thus, one has to know beforehand what the file name is. This is the case with web page systems. All files that you want someone to access can be accessed from the main web page.

If you wish to keep an activity log, which is a good idea unless you have a reason not to do so, then check the box for "Save Web Site Activity Log". Of course, if you will not look at the activity log, it will just take up space on the hard drive.

Once your directories are specified, you can return to the "Main" view and "Start" or "Stop" your web site. Click the "Start" button to make your web site available. Of course, you must be connected to the Internet or an intranet via a valid TCP/IP connection for others to see your PWS web site. The "Start" button turns into a "Stop" button.

Click the "Stop" button to make your web site available. The "Stop" button turns into a "Start" button. To see your web site via Internet Explorer, type the URL of your web site into the "Address" field and press Enter. If you now switch to Personal Web Server and "Stop" the web server and then switch to Internet Explore and "Refresh" the web page, you will no longer be able to access the web page since the web server has been stopped.

Database capability via SQL Server

The use of Microsoft SQL Server could easily fill several huge books (see, for example, [3], [4]). For the most part, SQL Server 2000 has a few improvements over SQL Server 7 (which was a big improvement to SQL Server 6.5), but for the most part, the setup and use of each is similar. A few comments and tips will be provided here to provide the big picture of what can be done and how to go about doing it.

Even if one desires database access, one should first determine if one actually needs to install SQL Server locally. If one has access to a production SQL Server and one is content to use it only when on the local intranet, then one does not need SQL Server on the development environment. Otherwise, there are many 120 day licenses for SQL Server available from various sources. If one has access to the developer edition of SQL Server (e.g., via an MSDN subscription), then there is no time limitation. The practical limitations on the developer edition are not important for development work.

Installing SQL Server from the CD is not very hard. For Windows 95/98, there is only one way to install SQL Server. The other ways are simply not allowed, but you have to chose the other ways before being told that they will not work. So, just follow the instructions. TCP/IP should already be installed on the computer. After installation, in both the "Client Network Utility" and the "Server Network Utility", the author has found it useful to remove every connection method that you are allowed to remove except for TCP/IP. That is the only way that the author could get a computer on an intranet to see the development version of SQL Server on another computer on the intranet. Otherwise, use the default options for everything.

You want to make sure that you have the latest version of the MDAC (Microsoft Data Access Components). As of Sat, Feb 24, 2001, the "Microsoft Data Access Components (MDAC) 2.5 RTM (2.50.4403.12) Download Page" was at

http://www.microsoft.com/data/download_250rtm.htm. Note: Version 2.6 was available, but had some disclaimers about not supporting certain features of SQL Server 7. After downloading, just run the executable to install the updated drivers and components.

There are several client tools that are useful in developing and testing databases.

  1. Enterprise Manager is used to interactively develop and test the configuration of databases on SQL Server.
  2. Query Analyzer is used as a simple IDE (Integrated Development Environment) to work with text files containing SQL and T-SQL code in text editor batch mode to develop and test the configuration of databases on SQL Server.

The advantage of interactive mode provided by Enterprise Manager is that it is interactive. The advantage of batch mode in Query Analyzer is that one can fairly easily test complex queries and stored procedures.

For a laptop whose computer name is rmsnyder, the SQL Server is referred to as rmsnyder, or RMSNYDER as the computer name is not case sensitive.

Microsoft Access can always be used on the development environment, but there are limitations and differences that can cause problems when attempting to use the same code to access both Access and/or SQL Server. In addition, Microsoft Access is very limited in its performance and capability compared to SQL Server.

One way to use Microsoft Access to get started is as follows.

  1. Create the database using Microsoft Access.
  2. Split the Access database into data (tables) and code (queries, forms, reports, macros, modules).
  3. Attach the data to the code part of the Access database.
  4. Use the upsizing wizard to upsize the tables of the Access database to SQL Server.
  5. Attach the SQL Server tables to the code part of the Access database. The data part of the Access database is no longer used.
  6. Using the code part of the Access database (e.g., forms, reports, macros, modules) now updates the SQL Server tables.
  7. A web interface can now be created to the SQL Server tables, without losing the functionality provided by the already developed Access code.

When connecting to the SQL Server database, always use the DSN-less connection method and, wherever possible, use the OLEDB connection method rather than the older ODBC method. Since connecting to the database can be one of the most frustrating aspects of using a database from an ASP page, here is the ASP code to connect to the Test database on the RMSNYDER SQL Server using user id Test with password Test. The only output of this code is that the ADO version of the MDAC is displayed.

<% Dim connect1 ' ADO connection object %>

<% Set connect1 = Server.CreateObject("ADODB.Connection") %>

<% connect1.Provider = "SQLOLEDB" %>

<% connect1.ConnectionString = _

"DATA SOURCE=RMSNYDER;DATABASE=Test;USER ID=Test;PASSWORD=Test;" %>

<% connect1.Mode = 3 ' 3=adModeReadWrite %>

<% connect1.ConnectionTimeout = 10 ' 10 seconds %>

<% connect1.Open %>

The ADO version is <%= Connect1.Version %>.

<% connect1.Close %>

<% Set connect1 = Nothing %>

Note that for this code to work, the RMSNYDER SQL Server must be up and running, the database Test must exist, there must be a user Test with password Test who can access this database. Also note that, for simplicity, no error handling code is included. If it were, a nonzero value for Err.Number after CreateObject and after Open should be checked and appropriate action taken if the command did not succeed. Also, the connection should always be opened and closed on the same page and the connection object set to Nothing to reclaim both the connect and the memory used by the connection.

For comparison, here is the ASP code to connect to a Microsoft Access database

D:\W\ASP.MDB\test-01.mdb.

<% Dim connect1 ' ADO connection object %>

<% Set connect1 = Server.CreateObject("ADODB.Connection") %>

<% connect1.Provider = "Microsoft.Jet.OLEDB.4.0" %>

<% connect1.ConnectionString = _

"Data Source=" & Server.MapPath("../ASP.MDB") & "/test-01.mdb" %>

<% connect1.Mode = 3 ' 3=adModeReadWrite %>

<% connect1.ConnectionTimeout = 10 ' 10 seconds %>

<% connect1.Open %>

The ADO version is <%= Connect1.Version %>.

<% connect1.Close %>

<% Set connect1 = Nothing %>

Note that the absolute path to the database from the web server point of view is obtained via the Server.MapPath function to the ASP page and then a relative file reference to the directory containing the database.

Summary

This paper has covered a brief introduction of how to set up a fully functional web development system that includes both web server and database server.

References

[1] Braginski, L., & Powell, M. (1998). Running Microsoft Internet Information Server. Redmond, WA: Microsoft Press.

[2] Hettihewa, S., & Held, K. (1997). Teach yourself Active Server Pages in 14 days. Indianapolis, IN: SamsNet.

[3] Petkovic, D. (2000). SQL Sever 2000: A beginner's guide. Berkeley, CA: Osborne/McGraw-Hill

[4] Shepker, M. (2000). Sams teach yourself SQL Server 7 in 24 hours. Indianapolis, IN: Sams.

[5] Snyder, R. (2000). Using Active Server Pages and a SQL Server database to create a class scheduling system. Proceedings of the 33rd Annual Conference of the Association of Small Computer Users in Education. Myrtle Beach, SC.

[6] Snyder, R. (2001). Using Active Server Pages and simulation techniques to create virtual M&M's. The Journal of Computing in Small Colleges. Vol 16, No. 2, p. .

[7] Snyder, R. (2001). Using Active Server Pages to add server-side functionality to an HTML web site. Proceedings of the 31st Annual Meeting of the Southeastern Region of the Decision Sciences Institute. Charlotte, NC.

[8] Snyder, R. (2001). Computer and information security considerations for installing and running Microsoft Internet Information Server and Microsoft SQL Server. Proceedings of the 34th Annual Conference of the Association of Small Computer Users in Education. Myrtle Beach, SC.

[9] Stewart, J., & Chandak, R. (1999). A guide to Microsoft Internet Information Server 4.0. Cambridge, MA: Course Technology.

[10] Weissinger, A. (2000). ASP in a nutshell: A desktop quick reference. Sebastopol, CA: O'Reilly & Associates.

 
 
Home - 2002 Conference - Proceedings - Newsletters - ASCUE-L Listserv - About ASCUE
©2001-2002 ASCUE, Inc.
email: clsmith@depauw.edu
http://www.ascue.org
Latest update: 3-nov-01