How to Create an ASP Page with VBScript

VBScript is a scripting language developed by Microsoft used to write the instructions to be executed on the server. In order to create an ASP page with VBScript, you need to include a directive to indicate the language used on the page is VBScript. The following instructions show how to create an ASP page using VBScript as the scripting language.

  1. Open your text editor.
  2. Enter the language directive. This tells the web server you are using VBScript.
    Lanaguage Directive
  3. The next statement to add is the Option Explicit statement. This statement checks that all variables used are declared using the Dim statement.
    Option Explicit
  4. Declare your variables using Dim statements. These statements can be on separate lines or on the same line separated by a comma as shown here:
    Declare Variables
  5. Assign values to your variables.
    Assign Values to Variables
  6. Write the values of your variables to the web page.
    Display Contents of Variables
  7. Document your code using comments preceded with an apostrophe.
    Comment in VBScript
  8. Use <% to indicate the beginning of the VBScript and %> to indicate the end of the script. The complete example is shown here:
    Complete Example
  9. Save your file as vbscriptpage.asp.
    Save File
  10. Browse to the location of file firstasp.asp which you just saved and select it.
    Browse for File
  11. Your page will appear as below in your browser.
    VBScript Page Displayed in Browser
Author: Kay McCabe
About Webucator
