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"%>
response.write("Hello world! - VBScript in IIS")

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

 About This Book

Introduction of VBScript - Visual Basic Scripting Edition

 What Is VBScript?

 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

 Arithmetic Operations

 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

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)


 Full Version in PDF/EPUB