VBScript Tutorials - Herong's Tutorial Examples - v6.02, by Herong Yang
Using VBScript with Internet Information Services
This section provides tutorial example on how to embed a VBScript code in a HTML document to be executed by IIS (Internet Information Services) on the server machine.
Internet Information Services (IIS) is a Microsoft product that offers and manages the Internet services, like the Web (HTTP) server, and the email (SMTP) server.
IIS also supports a VBScript host environment that allows you to embed VBScript code into source code of Web pages - HTML documents. VBScript code embedded in HTML documents will be executed while IIS is fetching HTML documents on the Web server to deliver to the client machine. This is also called server side scripting, because script code is executed on the server machine instead of the client machine.
One way to add VBScript code into your HTML documents for IIS to execute is to use the ASP (Active Server Pages) technology. If you have IIS installed on your Windows system, you can use the following steps to run a simple VBScript code in IIS.
1. Go to Control Panel, then Administrative Tools, then Internet Services Manager, and right mouse click on Default Web Site, then select properties command.
2. Click on Home Directory tab on the properties dialog box, then click the Configuration button.
3. Click on App Mappings tab on the configuration dialog box, then check to see the following line in the mapping area to make sure that ASP is supported by IIS:
Extension Executable Path Verbs .asp c:\winnt\system32\inetsrv\asp.dll GET,HEAD,POST,TRACE
4. Create the following hello.asp file:
<%@ language="vbscript"%> <html><body> <% response.write("Hello world! - VBScript in IIS") %> </body></html>
5. Copy hello.asp to \inetpub\wwwroot, which is the directory where IIS takes HTML documents.
6. Run Internet Explorer (IE) with this url: http://localhost/hello.asp.
7. You should see "Hello world! - VBScript in IIS" on the IE window.
Congratulations. You have successfully written a VBScript code for the host environment supported in IIS!
What happened here was:
Table of Contents
►Introduction of VBScript - Visual Basic Scripting Edition
Using VBScript with Internet Explorer 10 or Older
Using VBScript with Internet Explorer 11
►Using VBScript with Internet Information Services
Using VBScript with WSH (Windows Script Host)
Using Visual Basic with Microsoft Access
VBScript and Supporting Environments
Variant Data Type, Subtypes, and Literals
Numeric Comparison Operations and Logical Operations
String Operations - Concatenation and Comparison
Variable Declaration and Assignment Statement
Expression and Order of Operation Precedence
Statement Syntax and Statement Types
Array Data Type and Related Statements
Array References and Array Assignment Statements
Conditional Statements - "If ... Then" and "Select Case"
Loop Statements - "For", "While", and "Do"
"Function" and "Sub" Procedures
Inspecting Variables Received in Procedures
Error Handling Flag and the "Err" Object
Regular Expression Pattern Match and Replacement
scrrun.dll - Scripting Runtime DLL Library
IE Web Browser Supporting VBScript