Skip Navigation

Find cheat sheets for every topic, or make your own to share with your friends.

All Added Bytes cheat sheets are available free at Cheatography!

Visit Cheatography »

ASP / VBScript Cheat Sheet

A quick reference guide for ASP / VBScript, containing functions, collections, regular expression syntax and other useful bits of information.

The ASP cheat sheet is designed to act as a reminder and reference sheet, listing various of the oft-forgotten parts of ASP / VBScript. I no longer work full-time with ASP, so to ensure the cheat sheet was as helpful as possible, I roped in one Allan Wenham, an excellent ASP / .NET developer, to assist. Thanks Al!

A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size ASP cheat sheet.

Regular Expressions

Thumbnail highlighting regular expressions section.

VBScript has support for regular expressions, for pattern matching and replacements in strings. This section lists the various symbols used in regular expression patterns along with their meanings.

Date Function Arguments

Thumbnail highlighting date function arguments.

VBScript's date function(s) can take several different arguments, all with their own simple codes (eg Year, Month, Day, Week etc). This section lists these codes and meanings.

Redirect With 301 Header

Thumbnail highlighting 301 redirect section.

I appreciate this is a little unusual for a cheat sheet, but I find myself needing this with alarming regularity. VBScript's Response.Redirect function by default sends a "302" header, telling the recipient the page they were looking for has moved temporarily. A "301" header tells the recipient the page has moved permanently - and in SEO terms the ability to send 301 headers is very important. These lines of code are an alternative to Response.Redirect.

Include a File

Thumbnail highlighting include file section.

I had a little space here. A very little space. So 1 line of code that might prove useful has been roped in to fill it - the code you need to include a file.

Function Argument Orders

Thumbnail highlighting function argument orders section.

Function argument orders are possibly the easiest thing in almost any language to forget. This section lists some common functionns with their argument orders.

File Modes

Thumbnail highlighting file modes section.

When opening files, you can do so in several different ways, each requiring a different file mode. There are not many, but they are easy to forget - and this section lists the 3 file modes with what they do.

Common LCID Codes

Thumbnail highlighting common LCID codes section.

LCID codes are used to determine location-related settings, such as date formats, among other things. Personally I find myself fairly often hunting around for LCID code lists. This section lists the most common LCID codes, for the UK, US, France, Germany and Spain.

Constants

Thumbnail highlighting constants sections.

These three sections list several of the constants used in VBScript. The Date, Comparison and String constants seem to be the ones that people most often use and can least often remember offhand.

Methods and Properties

Thumbnail highlighting methods and properties lists.

The Request, Response, Session - and so on - objects all have a variety of methods and properties. This section lists methods and properties with each object.

Functions

Thumbnail highlighting functions list.

The functions list contains some of VBScript most used functions, for working with strings, dates, arrays and numbers.

Collections

Thumbnail highlighting collections sections.

When accessing, for example, data sent by the user, you will often use Request.Querystring or Request.Form. These are both commonly known as collections, and there are fair few of them at your disposal. This section lists those collections.

Download

So now that you know what it does, please feel free to print out the ASP cheat sheet:

And finally, if you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something nice - I'm very grateful!

Please note: If you wish to link to the ASP cheat sheet from elsewhere, please link to this page so others find the description, rather than linking directly to the sheet.

Related Cheat Sheets

SQL Server

SQL Server Cheat Sheet

This A4 reference lists the various functions available in Microsoft SQL Server, and demonstrates the creation of stored procedures, triggers and functions.

HTML

HTML Cheat Sheet

HTML is the language of the web. It is the semantic support on which websites depend. This A4 reference lists the various tags available to the web designer, as well as a selection of useful character entities, attributes and events.

Microformats

Microformats Cheat Sheet

Microformats allow us to add more information to our documents on the web, embedding semantic data in web pages that can then be parsed and used in other applications. This reference sheet contains an overview of the most often used microformats.


comments powered by Disqus