Before moving on to the application discussion, first we'll consider how to configure IIS according to the application's needs.
To avoid confusion with the tiered approach, I'm putting all the components of the application into the CGI directory, rather than putting the database files and HTML files in separate directories.
First we need the logic to process on the server. We'll write a C# program and then compile it to an EXE. This EXE is used to produce the necessary computations and presentations, which are sent back to the client (the browser window from which the request was generated).
Click here to download a zip file containing the source files for this article.
We start by creating a physical directory on the server to store our all files. For this example, I've created a directory named CGI in drive C:
To configure IIS, follow these steps:
Click Start, Settings, Control Panel. In the Control Panel, select Administrative Tools and then Internet Service Manager.
Right-click Default Web Sites and choose New, Virtual Directory (see Figure 1) to open the Virtual Directory Creation Wizard, which will help us through this process. Click Next.
Figure 1 Starting the Virtual Directory Creation Wizard.
Provide an alias for the virtual directory, to use as a quick reference and to identify it at the time of actual requests to the server (see Figure 2). It's a good practice to use the same name as the actual directory in which you'll place all the server-side logic (in our case, CGI).
Figure 2 Selecting an alias.
Indicate the actual directory where all the contents or server-side logic will be stored (see Figure 3).
Figure 3 Specifying the directory for the server-side logic.
Set the permissions (see Figure 4). We'll use the EXE component to respond to user actions on the client side; therefore, we must have Execute permission on the server to execute our EXE component.
Figure 4 Setting the permissions.