
by Dennis Jones
Windows 98 comes with the Microsoft Personal Web Server (PWS), a light-duty World Wide Web server that can sustain up to 10 simultaneous connections. You can use the PWS as the working server for a small intranet and/or as a development environment for such an intranet.
Alternatively, you can install the PWS onto a single, non-networked PC. In this configuration, you would use the PWS for developing and testing web sites and pages that could then be transferred to a more powerful server environment.
Associated closely with the PWS is the Personal Web Manager. As its name suggests, this is for managing webs that are hosted by the PWS. The Manager also furnishes web publishing facilities, a Home Page Wizard, and configuration tools. Together with the PWS, these facilities make up the Personal Web Services of Windows 98.
The core of these is the Personal Web Server itself. Even if you're not on a network, you can still experiment with the software, because the PWS can be installed and will function on a standalone machine. Of course, if you want to eventually move your pages to a web site that isn't on your PC, you need a connection to the computer where that site is located. On a standalone PC, this link is most likely to be a dial-up connection through a telephone line, to an Internet service provider (ISP). The ISP might also be providing the hardware and software resources needed to host the web site where the pages are to be published.
The PWS is not suitable as a server for a World Wide Web site because it isn't built to handle a lot of traffic. If you need to establish a World Wide Web site, talk with your ISP to find out what facilities they provide for doing this. Often this is a cheaper and easier alternative than purchasing the hardware and software necessary to do an adequate job of WWW hosting. In this situation, the Microsoft PWS can help you out as a development tool, so you can create and test your web prior to sending it on to the ISP.
The most appropriate use of the PWS, other than for development and/or experimental purposes, is to provide the facilities for a small-scale intranet. Most of the Personal Web Services associated with the PWS are best-suited to such a use. The PWS, functioning as an intranet web server, can give you a very effective way to share resources within your organization.
Simply put, a typical intranet is an internal network that uses the TCP/IP protocol to provide communications within a single organization. Intranets are essentially private, though they can provide restricted access points for outside users. Where they differ from other types of networks is in the use of a web server, together with related server technologies and web browsers. All of which are linked by the TCP/IP communications protocol and use HTML as the main document-creation language.
The heart of an intranet is its server. Servers come in many configurations and levels of capability. The Microsoft PWS, being at the lower end of the power spectrum, works well for an intranet in an organization of 5-10 workers. If you need more resources than this, you should probably consult with a networking specialist.
Another thing to keep in mind is that PWS for Windows 98 has no built-in user authentication, so it isn't a good choice for information environments where high security is a concern. In addition, the PWS does not provide an FTP service, so you need to install an FTP server from another software source if you want to provide this option on your intranet. However, the PWS does support Active Server Pages (ASPs), so if you need to host or develop ASPs, the PWS can do the job.
NOTE: The earlier versions of the Microsoft PWS (1.0 and 1.0a) did include an FTP service, but this was dropped in the new version.
The PWS is not installed in Windows 98 by default, so you have to set it up through the Start/Run dialog box. To carry out a basic installation, excluding any networking configuration, use the following procedure.
TIP: The PWS can also be installed via Control Panel, Add/Remove Programs, Windows Setup. Also, note that during a standard Windows 98 installation, a PWS program item is created under the Internet Explorer program group. If you click this PWS item, you are led to the actual installation of the PWS.
NOTE: The Custom install enables you to set up optional components of the PWS, including additional data access components, the Microsoft Message Queue, additional Transaction Server components, RAD support for Visual Interdev, and various advanced documentation. These components are for advanced web designs and designers, and are well beyond the scope of this chapter.
FIG. 37.1 You can specify a new default publishing folder in the Setup dialog box.
NOTE: A new shortcut icon with the title Publish is on your desktop even before you restart the computer. This is the shortcut to the Personal Web Manager, but you should not use the Manager until you have restarted your computer to complete the PWS installation.
After the computer has restarted, you see a new icon in the System Tray of the Windows 98 status bar. This icon indicates that the PWS is running. Note that the PWS is a system service, and once installed always loads at startup. Although you can't prevent the service from loading when the computer boots, you can start, stop, and pause the server. This is covered later in this chapter.
It's a good idea to test the PWS before continuing. The machine on which you installed the PWS will be either a standalone or a networked machine, so we'll cover these two essential cases.
The PWS communicates only through the TCP/IP protocol. Therefore a standalone machine, from the point of view of the PWS, can be either a PC that has no networking connections at all (except possibly a dial-up connection to the Internet) or one that is connected to a network that does not use the TCP/IP protocol.
The PWS requires that TCP/IP services be installed on its host machine, even if the machine is not networked or if its network is using some other protocol. If the services are not installed, you can find out how to install them in Chapter 38, "Configuring Windows Network Components."
After the server is installed, you should verify that it's working properly. Begin by starting Internet Explorer. In the browser's Address bar, type the web address http://127.0.0.1; this is a reserved IP address, valid on all computers, for the local machine. The 127.0.0.1 address will always work (assuming the server installation is error-free) even if the machine is not connected to a network or to the Internet.
TIP: With IE 3 or later, or Navigator 3 or later, you don't have to type the http:// part. In the example, typing 127.0.0.1 and pressing Enter opens the page.
After you've typed in the address, press Enter. After a brief pause, the default startup page, which was created when you installed the PWS, appears in the browser window (see Figure 37.2).
FIG. 37.2 The PWS's default startup page enables you to test the server installation.
If you look in the Address bar, you'll see that the page location (or URL) is http://127.0.0.1/IISSamples/Default/welcome.htm. If you want to check this out with Windows Explorer, you will find the file WELCOME.HTM (which is what you're looking at in the browser) stored on your hard drive at C:\Inetpub\iissamples\default\. As you can tell, this isn't the default publishing folder you specified during installation. Instead, it's a special sample folder to help get you started. The default publishing folder (C:\Inetpub\wwwroot) is where you would put the pages of your actual web, assuming you did not change this default during installation.
A more user-friendly address is the actual name of the computer, which you assigned during Windows 98 installation. If you've forgotten it, you can get it from the Personal Web Manager; simply double-click the Publish icon to start the Manager, and you'll see the line Web Publishing is On. Your home page is available at In the Manager's Main Window. Under this line, in blue, is a web address--http:// followed by a name; an example might be http://mypc. To use this name as the web address, simply type http://mypc into the browser Address bar (or just mypc, for recent browsers) and press Enter. The default startup page appears in the browser window.
When you know the server is working, you can close the browser.
NOTE: You might be familiar with earlier versions of the Microsoft PWS running on a standalone Windows 95 machine. In the Windows 95 environment, you need a HOSTS file to make the computer name into a valid web address, although the IP address 127.0.0.1 will always work without a HOSTS file. However, the new PWS running on a standalone machine does not need a HOSTS file; the PWS handles the mapping of the computer name to the 127.0.0.1 IP address for you.
This assumes that the TCP/IP network is properly configured to recognize your machine and its name. Network configuration is treated extensively elsewhere in this book and is far too complex to repeat here.
The simplest method of testing the PWS is to do it on the local machine. Start a browser and type http:// followed by the computer name--the name by which the network recognizes the machine--into the Address bar. Then press Enter. The PWS welcome page should appear in the browser window.
TIP: You can get the machine name from the Personal Web Manager, as described in the previous section; alternatively, you can obtain it from the Network Neighborhood, Properties, Identification tab.
For a more rigorous test, start a browser on another machine on the same TCP/IP network, and repeat the previous procedure. If the PWS welcome page does not appear, there might be something wrong with the network configuration. For help, refer to the chapters referenced in the previous cross-reference.
After the server has been completely installed, you can remove or add PWS components with the PWS setup program. If you need to do this, begin by inserting the Windows 98 CD into your CD-ROM drive. If the Windows 98 opening screen appears, close it.
After the CD is in the drive, you can start the PWS setup program in two ways. The easiest is to choose Start, Programs, Microsoft Personal Web Server, Personal Web Server Setup. Alternatively, you can use the Add/Remove Programs tool in the Control Panel. Open the Add/Remove Programs dialog box, select the Microsoft Personal Web Server entry, and then choose the Add/Remove button.
Whichever you do, the PWS setup program starts. When the Microsoft Personal Web Server Setup opening screen appears, choose Next. In the next screen, you have two choices (see Figure 37.3).
FIG. 37.3 You can remove the PWS completely, or add and remove components of it.
If you want to remove the server completely, choose Remove All and wait until you are instructed to restart the computer. Restarting completes the removal of the PWS.
If you want to remove or add server components, choose Add/Remove. This opens another screen, where you can specify what's to be added or removed (see Figure 37.4).
FIG. 37.4 The Select Components dialog box gives you a complete picture of the PWS components available for addition or removal.
In the Components list box, clear or check the appropriate check boxes to indicate which components you want added or removed. When you have finished, choose Next, and the setup program will modify the PWS installation. Depending on your selections, you might have to restart the computer to complete the setup.
TIP: The second choice in the Components list box is FrontPage 98 Server Extensions. These are installed by default. However, if you are not going to use FrontPage Express or FrontPage 98 to develop the pages hosted on the PWS, these extensions are not necessary, and you can remove them if you want to. Leaving them installed does no harm, however.
The PWS and the Personal Web Manager are tightly integrated. The Manager is the main control point for the PWS and gives you access to the rest of the Personal Web Services. You'll explore these tools and services in the next part of the chapter.
The shortcut icon for the Personal Web Manager, which was installed on the desktop during the setup process, is titled Publish. Double-click this icon to start the Manager. Alternatively, choose Start, Programs, Microsoft Personal Web Server, Personal Web Manager.
The Tip of the Day screen now opens over the main Manager window; if you don't want this to happen every time you start the Manager, clear the Show Tips at Startup check box. To step through all the Tips, choose Next for each new Tip.
When you finish with the Tips window, choose Close. Now you can use the services in the various Manager windows (see Figure 37.5). The Main window of the Manager, which is the default opening window, provides basic start/stop tools, and some usage statistics that may be useful if the PWS is used as an intranet server.
FIG. 37.5 The Personal Web Manager is your base for using Windows 98's Personal Web Services.
In the Publishing section of the Main window, you'll see the line Web Publishing Is On. Your Home Page Is Available At. Under this line, in blue, is a web address--http:// followed by a name. This name is actually the one you assigned to your computer when you installed Windows. It is also a name that you can use to access your web; you will remember doing this in the earlier section on testing the PWS.
For example, if you originally named your computer mypc, the blue line is http://mypc. To access the web under this name, type http://mypc into the Address bar of a browser, and press Enter to open the page. Upper- or lowercase is not important; either works.
You'll remember that you can also use the local-machine address 127.0.0.1 to open your web provided that the browser is running on the machine that contains the web. However, if the machine is connected to an intranet, the browsers on the other intranet machines can't access the web with that address because it is local-machine only. Those other browsers can instead use the computer name--mypc, in the previous example--to open the web. This assumes that the intranet is properly configured to recognize your machine and its name.
To stop the server, click the Stop button. This changes the button to a Start button, which you click again to restart the server. You stop the server if you need to make the web site unavailable to users. Note that the Server icon in the system tray remains visible, although it gets a red X on it when it's stopped. Stopping the server, as mentioned earlier, does not unload it from memory.
You can also pause the server. You must do this by right-clicking the Server icon in the system tray (the Manager does not have to be open). This opens a pop-up menu with four choices: Start, Stop, Pause, or Continue. Left-click the one you want.
The functional difference between Stop and Pause is this: If someone tries to access the server when it is stopped, the server does not respond, and the person eventually gets a browser message that it was not possible to connect to the server. If the server is paused, the person's browser gets a message that says, The System Cannot Find the File Specified. This lets the user know that at least the web site exists.
TIP: If you choose Pause, and if the Personal Web Manager window is open, the Start button changes to a Continue button.
You can use the View Statistics list box to show requests per day or hour, or visitors per day or hour. The Monitoring box also shows other server performance information:
The Manager has a short but useful tour built into it. Click the Tour icon in the left pane of the Manager window to view this introduction to the Personal Web Services that are built around the PWS.
The first time you choose the Web Site service, the Home Page Wizard opens (see Figure 37.6). You need to run this wizard before you can use the Publishing Wizard, which is started when you click the Publish icon.
FIG. 37.6 You can use the Home Page Wizard to create a home page on your Personal Web Server.
NOTE: If you're even moderately experienced at web design and configuration, you might not want to use the home page as produced by the wizard. This is perfectly possible, but might require some minor web reconfiguration. You'll learn how to do this later in the chapter.
To create the Home Page, start the wizard as described previously, and follow these steps:
FIG. 37.7 The Quick Setup page enables you to personalize the content of your home page and provides online assistance while you do this.
After the page is created, you can edit it. Open the Manager if necessary, and click the Web Site icon. The wizard opens again and enables you to edit your page, or view your Guest Book and drop box (see Figure 37.8).
To edit the page, click the Edit Your Home Page Link. This opens the form you used to create the home page. Modify the entries as needed, and click the Enter New Changes button when you are done.
FIG. 37.8 Editing your home page or viewing guest and drop box information is done through the Home Page Wizard.
Including the Guest Book in your home page, either at the time you create the page or if you add the option later, places a link to the Guest Book on the page. This enables visitors to leave you a record of their visit. Visitors can also read the Guest Book entries of other visitors to the site.
When you want to look at this record, open Personal Web Manager, click the Web Site icon, and choose the link to the Guest Book. This displays a query form where you can sort and select the entries you want to see.
To look at all the entries, set the Message Date to Less Than and the date to Today's Date. (This is the default condition, so you may not have to change it). When you click Submit Query, links to all the entries are displayed (see Figure 37.9).
You can also select entries according to date, sender, and subject. Use the query form to specify the values you want, and choose Submit Query. Links to the Guest Book entries are displayed on a scrollable form. Click the one you want to look at, and it displays. After it's displayed, you can use the >> and << buttons to move among the selected Guest Book entries.
TIP: Clicking a column header sorts the display by that header.
To delete a Guest Book entry, open the entry by clicking its link. Then, with the Guest Book entry open, click Delete. You can't restore a deleted entry, so be careful.
FIG. 37.9 Select all or some of the Guest Book entries with this Home Page Wizard form.
When you have finished viewing the entries, you can return to the selection form by clicking the Return to the Guest Book link at the bottom of the page (scroll down if you can't see it). You can also return to the Initial Home Page Wizard screen by clicking the Web Site link at the bottom of the page.
If you add the Drop Box option to your home page at creation time or with a later edit, a visitor can leave you messages by clicking the Drop Box link and filling in a form. The Drop Box differs from the Guest Book entries in that other visitors cannot see the message.
To view your messages, open the Personal Web Manager; then click the Web Site icon. Click the Open Your Drop Box link to display the message links. As with the Guest Book, clicking a column header sorts the display by that header. Click the links to display the message texts, and use the >> and << buttons to move among the messages.
If you need to delete a message, first display it. Then, with the message open, click Delete. Deleting a message cannot be undone.
You can return to the main Drop Box list by clicking the Return to the Drop Box link at the bottom of the page (scroll down if you can't see it). You can also return to the initial Home Page Wizard screen by clicking the Web Site link at the bottom of the page.
After the Home Page Wizard has run and the home page has been created, open the Home Directory. This, as you remember, is the folder C:\Inetpub\wwwroot. You can look at it using Windows Explorer, but if you have already opened Personal Web Manager, there's a faster way: in the Main window, click the blue path name next to the words Your Home Directory. This automatically opens Windows Explorer to the home directory.
TIP: You can also open your home page quickly, by clicking the blue URL that sits immediately above the Stop button in the Main window.
In the Explorer window, click the wwwroot folder in the left pane, if it isn't already selected. In the right pane, the files and folders contained in wwwroot appear. If you're moderately familiar with web files, you might wonder why you don't see DEFAULT.HTM, the default home page of the web, in this folder. What you do see, instead, is a file named DEFAULT.ASP.
Nevertheless, DEFAULT.ASP is the home page you created with the wizard. ASP stands for Active Server Pages, a Microsoft software technology that (this is very oversimplified) enables the server to combine HTML, scripts, and ActiveX components to do on-the-fly creation of interactive web pages. However, you need to have some knowledge of programming and scripting, as well as HTML, to create Active Server Pages from scratch. That's why the Personal Web Services include a Home Page Wizard--it's so you can set up an interactive home page, with a Guest Book and Drop Box, without knowing anything about Active Server Pages.
At some point, you might want to replace the wizard-produced ASP-type home page with a different page. As mentioned earlier, this might require some minor web reconfiguration and is dealt with later in this chapter.
NOTE: Some non-Microsoft servers require that the default home page be named INDEX.HTM. If you're going to publish your site to a non-Microsoft server, check with the server administrator to see if this is the case.
After you've created the home page with the Home Page Wizard, you can start using the Publishing Wizard. The Publishing Wizard enables you to easily add documents to your web and automatically adds links to them to your home page. Other people with access to the web--through an intranet, for example--can then access these documents. Making documents available in this way is what is meant by publishing. Documents do not have to be web pages; that is, they do not have to be HTML files.
Of course, you can make documents available without using the Publishing Wizard. This is covered later in this chapter.
The Publishing directory is a special folder called webpub, located at C:\Inetpub\webpub, and is created during installation of the PWS. It is a read-only directory, which means that documents placed in it cannot be modified. This protects them from being changed by curious, malicious, or meddling visitors to your site--or by you, accidentally.
When you use the wizard to publish a document, a copy--not the original--of the document is made in the Publishing directory. The wizard also maintains a record of the document's original location, so that you can easily update the copy if the original is modified. Deleting a document in the Publishing directory does not delete the original document. Finally, the wizard puts a link to the document on your home page, so that people can get to it after they have your home page open.
To use the wizard, start the Personal Web Manager and click the Publish icon in the sidebar. The Publishing Wizard introductory dialog box opens. Then carry out the following procedure:
FIG. 37.10 The Publishing Wizard form is where you select the documents that will be copied into your webpub Publishing directory.
FIG. 37.11 Here, three documents have been specified for publication and appear in the Files to Publish list box.
FIG. 37.12 The Publishing Wizard also lets you carry out editing and document maintenance of the contents of the webpub folder.
FIG. 37.13 You use this dialog box to remove documents from publication.
After you run the Publishing Wizard for the first time and have placed at least one document in the Publishing directory, the wizard automatically opens with the What Do You Want To Do dialog box when you run it again. Follow the appropriate steps, listed previously, to add, remove, refresh, or redescribe any documents published.
CAUTION: If you accidentally specify an incorrect document path name, the wizard will still add it to the list of documents to be added, removed, or refreshed. You finally get an error message, which asks you to restart the wizard, when you choose the >> button to carry out the operation. If you've just assembled a lengthy list of documents for processing, this can be an annoyance, so be sure all file and path names are correct. Using Browse reduces such errors. Note that this also happens if you try to add a file to the Publishing directory and the file is already there. However, duplicated file descriptions, as distinct from duplicated file names, do not cause an error.
To see the results of the Publishing Wizard, open the home page in your browser. You will see that a link called View My Published Documents has been added to the page. Click this link to view the contents of the Publishing directory. You might see something like the display in Figure 37.14.
FIG. 37.14 Four documents are available in this Publishing directory. Note that they are not all web pages (HTML files)--three of the four are text files.
As you've already realized, the Publishing Wizard does not care about the file formats it places in the Publishing directory. A visitor can view a non-HTML file, however, only if his machine has a program that is capable of displaying that kind of file.
You can select documents to add by using the Publishing Wizard's Browse button, rather than typing the document path names. This is less prone to error, especially when the path names are long and complicated. Do this:
FIG. 37.15 The Browse button opens a browser window where you can select files for addition to the Publishing directory.
NOTE: At the time of writing (April, 1998) the Browse tool of the Publishing Wizard had some rough edges. If these persist in the release product, you might need to click a folder icon, wait till a gray selection bar appears, and then click the folder again to open it. Also, you cannot select multiple files in Browse and add them all at once to the wizard. Further, to reference another disk, you have to type its drive designation into the Look In text box, and then click the Up folder icon at the right end of the text box. Finally, the response time of the Browse tool is rather poor.
You can also use Windows Explorer to copy or move an existing document from somewhere in your file system, into the webpub folder. This removes any need to use the Publishing Wizard, and you get some of the wizard's benefits; the very act of placing a file in the webpub folder automatically inserts a link to that file into the home page. You can then use the wizard to edit the link description. The drawback is that you can't refresh the document using the wizard; if you try to, the wizard politely informs you that this is not possible.
Note, however, that placing a document into the home directory of C:\Inetpub\wwwroot does not place a link to this document on the home page. This automatic linking works only with the webpub Publishing directory. Also, if you have a home page other than the one produced by the Home Page Wizard, this automatic linking does not occur.
The simplest way to add documents and subdirectories to the home directory is to use Windows Explorer to create folders and subfolders within the home directory. After the web structure is set up, you can use a Web Page Editor to create, store, and link HTML pages and other types of documents within that structure.
In some cases, however, you may find that virtual directories are a better method of adding content to a web. The use of virtual directories is examined later in this chapter.
The Advanced Service of the Personal Web Manager enables you to reconfigure your web site according to new or changed circumstances. For example, you might need to replace the home page generated by the wizard with a home page of your own design. This is just one possibility of several, all of which will be examined in the next sections.
Before beginning this task, let's briefly examine how home pages and home directories behave when accessed by a browser. A user accesses a site by using one of two basic methods. If the user uses a path name that ends with a filename (such as http://mypc/reviews/books.htm) then the named page--BOOKS.HTM, in this example--appears in the browser.
However, if the user leaves out the filename and types only the path, such as http://mypc/reviews, the server has to figure out which file to send. Usually there is some sort of default page in the specified directory, and this is the page the server sends to the browser. The default page of the home directory (http://mypc in the example) is the one we usually refer to as the home page of the web. Note, however, that each subdirectory of the home directory can also have its default page; it's sort of a home page for the subdirectory.
As you remember, the default home page created by the Home Page Wizard is C:\Inetpub\wwwroot\default.asp. If you have a different home page you want to use, such as DEFAULT.HTM, you can simply copy it into the wwwroot folder using Windows Explorer.
Then, however, you might need to make a configuration change. Start the Personal Web manager and click the Advanced icon. The Advanced Options dialog box opens (see Figure 37.16).
FIG. 37.16 You use the Advanced Options dialogs to modify the configuration of your web.
Look at the text box labeled Default Documents(s). As installed, it will have the filenames DEFAULT.HTM and DEFAULT.ASP in it. The entries in this box specify which page the server sends to the browser when the browser first accesses the site.
Let's assume that the name of your PC is mypc, and therefore your web's name is mypc. When a user types http://mypc into the browser, the page first reached is specified by the entries in the Default Document text box, and by their order. DEFAULT.HTM is the first entry, so the server will try to find that file in the home directory, wwwroot. Because you put the file there, the server finds it and sends it to the browser.
As you likely have figured out, if DEFAULT.HTM were not present, the server would search for the next name in the list and find DEFAULT.ASP. DEFAULT.ASP is still in the directory (unless you deleted it,) so the server would send that page to the browser.
You can also delete the existing DEFAULT.ASP and replace it with one of your own design. If you want the server to search for DEFAULT.ASP first and DEFAULT.HTM second, edit the list in the Default Documents text box to reverse the search order. You must put a comma between each file name.
If you want the server to search for only one default filename, edit the list to show only that name.
But what happens if the document is not found? This can result from leaving a comma out of the file list, from naming errors, or because the file is not present. In that case, the server returns an error message saying, Directory Listing Denied. This also happens if you unmark the check box labeled Enable Default Document, unless Directory Browsing is allowed. Directory Browsing is discussed in the section after the next.
You can extend the previous principle to subdirectories. Suppose you wanted to use SUBDEF.HTM as the name of the default file of each subdirectory of your web. First, name the desired subdirectory default pages to SUBDEF.HTM. Then, in the Advanced Options dialog box of the Personal Web Manager, edit the list in the Default Documents text box to read DEFAULT.HTM, SUBDEF.HTM. When a user visits the web and navigates to a subdirectory of it, the server searches for these two names when it opens the subdirectory. It can't find DEFAULT.HTM in the subdirectory, but it does find SUBDEF.HTM. It then sends SUBDEF.HTM to the browser.
This is a plain-vanilla way of displaying the documents on your site. You might consider using it if you frequently add to or delete from your site content or if you have a lot of documents in non-HTML format in the site.
To enable Directory Browsing, go to the Advanced Options dialog box of the Personal Web Manager. Unmark the Enable Default Document check box, and mark the Allow Directory Browsing check box. Now, when a visitor enters the site, he or she sees a display like the one in Figure 37.17. To navigate the site, the visitor clicks the various links.
FIG. 37.17 Directory Browsing gives a straightforward list of files and subdirectories within a directory.
You might find it convenient, for some webs, to mark both the Enable Default Document and Allow Directory Browsing check boxes. With this arrangement, a visitor who enters a directory containing a default document sees that document. However, if you omit a default document from a particular directory, and set up a link to that directory rather than to a page in it, the visitor sees a directory listing after clicking the link. This means you can set up frequently changed directories to use directory browsing, while relatively static directories can have a normal HTML default page.
Before going into this, it would be a good idea to explain briefly the usage of default documents in the context of a web's structure. Every web has a home directory that serves as the primary entry point for visitors; this is where the web's home page is stored. Using our earlier example of a web name, when a visitor types the address http://mypc into the browser, he or she is automatically taken to the home page DEFAULT.ASP of the C:\Inetpub\wwwroot folder (assuming a default installation).
Suppose, however, that you already have an existing web nestled in its own carefully thought-out folder layout, and this is the web you want people to access when they type http://mypc into their browsers. However, you don't want to endure the complications of moving all of the web's folders and files over into the C:\Inetpub\wwwroot structure.
As an example, imagine that this web has a top-level folder called C:\Reviews, and this folder in turn has two subfolders, one called Books, the other called Movies. You want the home page stored in the Reviews folder to be the page that visitors first see when they access your web site. Finally, assume that this home page in the Reviews folder is named DEFAULT.HTM.
To change the default Home Directory from C:\Inetpub\wwwroot to C:\Reviews, follow these steps:
FIG. 37.18 The Edit Directory dialog box enables you to change the Home Directory and modify the permissions associated with it.
You'll notice that even after the change has taken place, the directory tree shown in the Virtual Directories window shows no visible difference. This is because the window is a display of a virtual directory structure, not a display of a physical directory structure like that of Windows Explorer. All three folders of the Reviews web, in the example, are "contained" in the <Home> folder at the top of the virtual directory tree.
However, if you now open the Reviews web in a browser, your changed home page appears, and its links lead to the other pages and files of that web. You can still use the webpub directory, if you need to. You don't have to physically move it to the home directory of your new web. This is because it's also a virtual directory of the home directory in this display. You'll learn more about virtual directories later in this chapter.
You encountered the PWS directory access permissions for the first time in the previous section. As you saw, access permissions come in three flavors: Read, Execute, and Scripts. Each has its own characteristics, as follows:
CAUTION: Even if you don't provide links to certain content in the home directory and in its contained folders, this content can still be viewed by visitors, provided they can discover the file and folder names. Keep only public-access material in the home directory and its contained folders.
A virtual directory is a directory that is not physically contained within the home directory. With the PWS, this home directory (at default) is the folder C:\Inetpub\wwwroot. If you add virtual directories to your web, browsers see these directories as being contained in the home directory, though they are not physically there.
There is a very important security point to be noted about the home directory. It and any subdirectories physically within it are effectively publishing directories, accessible to anyone who visits your site even if you haven't included any links to those subdirectories or to their content. This is because the access permissions applied to the home directory affect both it and the subdirectories physically contained within it; you can't apply permissions on a directory-by-directory basis. So, if you remove Read access from your home directory, nobody can view anything in it, or in its subdirectories. This rather defeats the purpose of your web! Virtual directories provide a way around this.
Additionally, virtual directories make your site more secure because they use an alias. An alias is a name that a browser uses to access a directory, but it is not the real path name to the directory; hence users can't determine where your files are physically located on your PC.
Finally, virtual directories make it easier to modify or reorganize a web site. If your web site uses virtual directories, you can rename and move the real ones as much as you like and simply use the Personal Web Manager to re-map the connection between the virtual directories and the real ones.
Earlier, you looked briefly at the virtual directory structure provided by the PWS. Now it's time for a more detailed examination; start the Personal Web Manager, and click the Advanced icon. The Advanced Options dialog box appears, with the Virtual Directories Tree displayed (see Figure 37.19)
FIG. 37.19 The Virtual Directories tree helps you organize the "virtual structure" of your web.
You probably have wondered what all these virtual directories do, especially since they are present even when you change the home directory from the PWS default to a home directory of your own choosing. The essentials are as follows:
The previous list did not include the virtual directories _private, and all the directories beginning with _vti. These directories are associated with the FrontPage server extensions and are needed if the PWS is to run pages you create with FrontPage Express or FrontPage itself. If you aren't going to use FrontPage in either flavor, you don't need these directories. However, you should not simply remove them with the Remove button, as this might cause the PWS to behave unpredictably. You should instead use the PWS Setup program to uninstall the FrontPage Server Extensions.
Using virtual directories can extend the content of your web without requiring drastic changes to your disk's file structure. However, because virtual directories can be a bit confusing at first, let's work with a concrete example. This will be the Reviews web examined in an earlier section of this chapter, on "Changing a Home Directory." This web has a top-level folder called C:\Reviews, and this folder in turn has two subfolders, one called Books, the other called Movies. Within each folder are pages with links to other pages in other folders.
Assume that this web is now the home directory of the PWS. You can verify the identity of a home directory with the following procedure.
Open the Personal Web Manager and click the Advanced icon. In the Virtual Directories tree display, select the <Home> icon, and then choose Edit Properties. The Directory text box tells you that the home directory is indeed C:\Reviews. As mentioned earlier, the virtual directory tree does not show physical subdirectories, such as Movies or Books. This is because they are subsumed under the <Home> virtual directory.
Now assume you have another folder, called C:\Writing, whose content you want to include in your web. You could, of course, physically move or copy this folder into your web's home directory (C:\Reviews in our example). However, it's easier to simply make it into a virtual directory. Then, if you later decide to remove the folder's content from the web, all you need do is remove the virtual directory from the Personal Web Manager's Virtual Directory tree. Doing this has no effect on the real folder called Writing or on its content.
Here's what you do to create a virtual directory that references a physical directory. This example assumes that the virtual directory will be a subdirectory of the home directory.
FIG. 37.20 You use the Add Directory dialog box to add a virtual directory to the tree.
Note that a virtual directory can be added as a subdirectory of any higher virtual directory. For example, you could have created Novel as a virtual subdirectory of the /SCRIPTS virtual directory. This gives you enormous flexibility in creating web structures.
Now you can set up links on your other pages to reference the pages in the new virtual directory. However, note that the links that reference the pages of a virtual directory must use the directory's alias in the URL of the link rather than the actual name of the physical directory. For example, if the physical directory is named Writing, and the alias assigned to the virtual directory is Novel, then the URLs of such links must reference Novel, not Writing.
Now, when a user goes to your web and accesses a page in the virtual directory, the visible address (in the example) is http://mypc/novel/. The existence of the Writing folder is hidden.
Using virtual directories has one big advantage over using physical directories.
Suppose you have a home page that has a dozen links to pages in a physical (not virtual) directory. The name of this physical directory is Writing. Now suppose you move the physical directory Writing and all its content to somewhere else in your PC's file structure. You then have to manually edit the URL of each link on the home page to reflect the change in the location of Writing. If you don't, the links do not work any more.
This can be a big job if many links are involved. However, if the links are to a virtual directory, the change is simple.
NOTE: Web restructuring is one reason why the subdirectories of the home directory are not listed in the virtual directory tree. If you need to move the home directory's subdirectories around, you do so only in Windows Explorer and don't have to repeat the operation in the virtual directory tree.
Now suppose the physical directory is Writing and your web uses a virtual directory to access it, under the alias Novel. Suppose also that the links on the home page reference the virtual directory Novel, instead of the physical directory Writing. Then use the following procedure:
Assume now that you create another directory called Programs as a physical subdirectory of C:\Reviews. Into Programs you put some utility programs that you want visitors to be able to run. However, you don't want your visitors to be able to see the program files themselves; in other words, you don't want this directory to have Read access, just Execute access, so the utility programs can run.
However, you soon realize that visitors can indeed see and even download the files containing these utilities. This is because the files are in a physical subdirectory of the home directory and are therefore in a readable directory, because all the subdirectories of a home directory must inherit the home directory's access permissions. What do you do?
You make the Programs directory into a virtual directory and set its access permissions in that directory. Begin by using Windows Explorer to move (not copy) the Programs folder to some other place in your file structure, so it's no longer a subfolder of the Reviews folder.
Then, using the procedure you learned earlier in this chapter, create a virtual directory that references the physical directory; for security, use a different name as the alias. Then unmark the Read and Scripts check boxes, and mark the Execute check box. Now the programs can be run by users, but the users have no other access to them.
If you go to the Advanced Options dialog box of the Manager and mark the check box labeled Save Web Site Activity Log, then the PWS maintains a log of who has visited your site. This can be a useful security check on site activity. The files are stored in the Windows\System folder in a folder named W3svc1. The names begin with NC followed by year, month, and day as numbers. The logs are in NCSA log file format and are viewable in any text editor.
© Copyright, Macmillan Computer Publishing. All rights reserved.