How to configure the ASP runtime environment
1. If your operating system is Windows 98, run the WINDOWS98 installation CD. Locate the PWS installer in its ADD-ONS\PWS directory and run the installation
2. If the operating system is more than Windows 2000, you can install IIS as shown in 4.1.1:
Open Control Panel and locate Add/Remove Programs → add/Remove Windows components.
Eject the Windows Components Wizard, select Internet Information Services (IIS) (in Windows Server 2003, this option is in the "Use Program server" details), insert the installation disk, and press "next" to start the installation. As the 4.1.1 shows:
Figure 4.1.1 Select Install IIS Service
Once the installation is successful, you can configure IIS as you want. First you need to know that IIS acts as a virtual role in the process we use. That is, we are "pretending" to place part of the space on the local disk as a "server" (in fact, the Web site we visit is stored on a dedicated network server). Since we also want to access the content on the server (although it exists on this computer), we also have to access it through a pattern similar to that of visiting the site.
The default directory for IIS is installed in the system disk: \inetpub\wwwroot, which means that the above virtual directory http://localhost or http://127.0.0.1 is actually executing the physical path on your machine as the system disk: \inetpub\ Wwwroot, try to see if the Localstart.asp in the IIS Start page is in the Wwwroot directory? Similarly, if you have a b.asp file in Wwwroot, you can also access it through http://localhost/b.asp or http://127.0.0.1/b.asp.
Note: Although the ASP environment (PWS) can also be configured under WINDOWS98, we strongly recommend that you use Windows2000 and its subsequent version of the Web server (IIS) to configure the ASP environment. The examples in this book are also based on the IIS method.
Tip: PWS is the abbreviation for the personal Web server, the transliteration is "personal network Server", and IIS is the abbreviation of Internet Information Server, the transliteration is "Internet Information Server". From a literal point of view, you can tell which one is more powerful.
Tip: Although the default directory is defined on the system disk: \Inetpub\Wwwroot, but in general. We still don't use it directly. Because over the years, the inevitable we have to operate multiple ASP files, or debug multiple ASP sites, if the files are scattered in the wwwroot, will cause a lot of unnecessary trouble. It is best to build a separate folder for each unrelated file group.
Also, the default directory for Wwwroot can be changed. Go to control Panel → administrative tools → Internet Services Manager Double-click it to appear in the main interface of the Internet information Server, find "computer name" in the form, and then appear: "Default FTP Site", "Default Web site", and "default SMTP Virtual Server ". You can perform many of the configuration of IIS by right-clicking on the default Web site and choosing Properties.
Special Tips
Here, we highlight a few of the more important configurations:
1. "Properties" → "home Directory", you can modify the default virtual path and the implementation of the ASP file permissions (in addition to the virtual directory needs to change, other generally with the default setting is advisable).
2. "Properties" → "document", the default document means: If you only add index.asp in a virtual directory (if it is wwwroot) as the default document. So when you enter http://localhost or http://127.0.0.1 in the browser, the default Access file is Index.asp, just like when you visit Http://www.flash8.net, It is actually accessing an index file (such as Default.asp or index.asp, etc.) in the flash8.net.
Now, your configuration is complete. If your computer is in the LAN, other computers can access your site, as long as the input http://your machine name, if you connect to the Internet, others just enter your IP address on it.
Give it a try:
First ASP program:
As mentioned above, given the cleanliness of the virtual directory and the habit of developing good habits in everyday work, we recommend that you create a separate folder for this ASP program. If the system disk: \inetpub\project1\, accordingly, we also give it the need to specify a virtual directory. Right-click on the Default Web site, select new → virtual directory, and IIS will guide you to the Virtual Directory Creation Wizard page and ask you for an alias for your virtual directory. We can name it P1, press "Next", in the actual target path, point to the system disk: \inetpub\project1\ all the way "next" to complete the new directory configuration.
In the past, writing the first project was to let it show "Hello World" to represent its own work "published", we do not break this rule. Create a new Notepad file (. txt) in the directory you just configured to write the following code:
<%
Response.Write "Hello World my First ASP program!" "
%><%
Response.Write "Hello World my First ASP program!"
%>
Save As 1st.asp, and then enter http://localhost/1st.asp or http://127.0.0.1/1st.asp in the browser to test the effect. The effect is as shown in Figure 4.1.2:
Figure 4.1.2 First ASP program
How about it? After seeing the demo, do you have a feeling of being eager? OK, here We go ~
Special Notes
Do not imagine how complicated the program is. As long as we straighten out the idea, and then follow the best ideas to the computer's "implementation method", all the problems will be solved.