Configure IIS 5.0 to support virtual directories for departmental Web sites

You can give every department its own Web site by creating subsites on your main IIS server. Simply use the Virtual Directories feature in IIS 5.0 to easily create Web sites that your users can populate with content.

The CIO calls you into a meeting and suggests making Web pages available for each department in the company. These Web pages would provide a place for customers to find out about each department in your organization and how to contact department members directly.

You can use virtual directories on your IIS server to quickly set up these Web pages. IIS can redirect a user’s browser to a specific directory on the IIS server that each department can build a Web site around. In this Daily Feature, I’ll show you how it’s done.

Virtual directories are easy in IIS
Internet Information Server (IIS) 5.0 supports the creation and maintenance of a full-scale Web site for your entire company. However, by using the virtual directories feature, you can also create small-scale Web sites. By granting write access to the virtual directories, you can delegate the creation of these small Web sites to other people in your organization.

By default, IIS locates files in the C:\Inetpub\Wwwroot folder on your IIS server. When you create one large Web site using IIS, all of your files start there. You can then use virtual directories to store files for your departmental or user Web sites.

Virtual directories have many of the same properties as the default Web site because you’re essentially creating another storage area within your default Web site. The virtual directory is just an alias to a folder you’ve already created on your IIS server. Visitors access the virtual directory through their Web browser, just as if they’re accessing your main Web site. However, rather than entering into their browser, they would enter, where vdir is the virtual directory you’ve created.

Running the Virtual Directory Creation Wizard
You can create virtual directories using the Virtual Directory Creation Wizard. To start the wizard, start the Internet Services Manager by clicking Start | Programs | Administrative Tools | Internet Services Manager. When the Internet Services Manager starts, navigate the left tree structure by clicking Servername | Default Web Site. Right-click Default Web Site and click New | Virtual Directory.

You’ll then see the Virtual Directory Creation Wizard Welcome screen appear. Click Next to proceed past the Welcome screen. You’ll then see the Virtual Directory Alias screen shown in Figure A.

Figure A
Enter the name of the virtual directory here.

Here you’ll be asked to create an alias for your storage folder on the server. The alias is a name you’ll use from the main root domain of the Web server to find information for this particular site. In the figure, noticed that I entered support in the Alias field. This is to create a Web site for the organization’s Support Department’s data. After you enter the alias, click Next.

You’ll then see the Web Site Content Directory screen. In the Directory field, enter the directory where you’ll store the data for the site. To make things easier to remember, you may want to enter a directory name that reflects the alias you entered previously. For example, I entered support for the Web site’s alias. In the Directory field, I entered C:\Inetpub\Wwwroot\Support for the Support Web site.

One note of warning—the directory you enter in the Directory field must already exist. The wizard won’t create it for you. If you enter a directory name that doesn’t exist, the wizard will display an error and prompt you to enter a new directory. If this happens, you don’t have to exit the wizard. Just open a command prompt and manually create the directory. You can then enter it in the Directory field. The virtual directory you create doesn’t have to reside on the same hard drive or beneath the C:\Inetpub\Wwwroot directory. You can create the directory on any hard drive on your server. Click Next after you’ve entered the directory information.

You’ll then see the Access Permissions screen. Here, you’ll specify what visitors are allowed to do with the content located in this directory. Don’t confuse these permissions with the permissions you’ll set for users who will populate the directory.

Permissions you can set include:
  • Read: The read option allows visitors to read or view the content in the support site. This means they can see only what you show them and nothing more.
  • Run Scripts (Such As ASP): Run Scripts will allow users to access dynamic Web pages hosted in this virtual directory (if any) written in scripting languages like PHP and Microsoft’s ASP.
  • Execute (Such As ISAPI Applications Or CGI): Execute will allow users to execute whole programs that you’ve saved to the server. Typically these might be things like guestbook applications written using the Common Gateway Interface (CGI).
  • Write: The write permission allows users to write data to the Support folder on the server. It’s usually not a good idea to give write permission to users unless the only ones accessing the site will be server administrators or trusted individuals.
  • Browse: The browse command lets visitors traverse the directory structure of the support virtual directory and see the files and folders stored within this folder.

After you set permissions, click Next. You’ll then see the Finish screen. Click Finish to end the wizard.

Virtually possible
Keep in mind when creating virtual directories, just as in creating your first Web site, that you must plan at least some of the initial content before going through all the motions so that you can justify the need. It’s convenient to use a virtual directory, but it still requires IIS and Windows 2000 to use resources. No matter how small it may seem, the use of resources is very important in managing and using IIS to the best of its capability.


About Derek Schauland

Derek Schauland has been tinkering with Windows systems since 1997. He has supported Windows NT 4, worked phone support for an ISP, and is currently the IT Manager for a manufacturing company in Wisconsin.

Editor's Picks