Inspecting ASP/Javascript

A quick reference to code ASP with Javascript. Available querystring parameters are:

Running engine: JScript version 5.8.23676

ASP/Javascript Request object

Javascript cannot use ASP type directly, they should be translated into Javascript ones first.

Request.QueryString("s") ⇒ (object)

use this instead:

Request.QueryString("s")() ⇒ (undefined)

or:

String(Request.QueryString("s")) ⇒ (string)undefined

or:

(new String(Request.QueryString("s"))).valueOf() ⇒ (string)undefined

note that:

new String(Request.QueryString("s")) ⇒ (object)undefined

ASP/Javascript Error object

code result
try {
    var Conn = new ActiveXObject( String( Request.QueryString("o") ) );
} catch(E) {
    Response.write("E.aspCode: {code}\n".replace(/{code}/gi, E.aspCode));
    Response.write("E.aspDescription: {description}\n".replace(/{description}/gi, E.aspDescription));
    Response.write("E.number: {number}\n".replace(/{number}/gi, E.number));
    Response.write("E.description: {description}\n".replace(/{description}/gi, E.description));
    Response.write("E.file: {file}\n".replace(/{file}/gi, E.file));
    Response.write("E.line: {line}\n".replace(/{line}/gi, E.line));
    Response.write("E.column: {column}\n".replace(/{column}/gi, E.column));
    Response.write("E.source: {source}\n".replace(/{source}/gi, E.source));
} finally {
    Conn = null;
}
E.aspCode: undefined
E.aspDescription: undefined
E.number: -2146827859
E.description: Automation server can't create object
E.file: undefined
E.line: undefined
E.column: undefined
E.source: undefined

Enumerator

Javascript cannot access ASP Collection with for each. It needs an enumerator instead.

var E = new Enumerator( Request.ServerVariables );
for(var x; !E.atEnd(); E.moveNext()) {
    x = E.item();
    Response.write("{variable}{content}".replace(/{variable}/gi, x).replace(/{content}/gi, Request.ServerVariables(x)));
}
E = null;

produces:
Variable Content
ALL_HTTPHTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_ENCODING:x-gzip, gzip, deflate HTTP_HOST:evolved.com.br HTTP_USER_AGENT:CCBot/2.0 (http://commoncrawl.org/faq/) HTTP_X_FORWARDED_PROTO:https HTTP_X_FORWARDED_FOR:23.22.136.56
ALL_RAWAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: x-gzip, gzip, deflate Host: evolved.com.br User-Agent: CCBot/2.0 (http://commoncrawl.org/faq/) X-Forwarded-Proto: https X-Forwarded-For: 23.22.136.56
APPL_MD_PATH/LM/W3SVC/873784055/Root
APPL_PHYSICAL_PATHC:\var\www\unittest.evolved.com.br\
AUTH_PASSWORD
AUTH_TYPE
AUTH_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH0
CONTENT_TYPE
GATEWAY_INTERFACECGI/1.1
HTTPSoff
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID873784055
INSTANCE_META_PATH/LM/W3SVC/873784055
LOCAL_ADDR192.168.5.20
LOGON_USER
PATH_INFO/mootools.1.99.asp
PATH_TRANSLATEDC:\var\www\unittest.evolved.com.br\mootools.1.99.asp
QUERY_STRING
REMOTE_ADDR192.168.5.19
REMOTE_HOST192.168.5.19
REMOTE_USER
REQUEST_METHODGET
SCRIPT_NAME/mootools.1.99.asp
SERVER_NAMEevolved.com.br
SERVER_PORT80
SERVER_PORT_SECURE0
SERVER_PROTOCOLHTTP/1.0
SERVER_SOFTWAREMicrosoft-IIS/6.0
URL/mootools.1.99.asp
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODINGx-gzip, gzip, deflate
HTTP_HOSTevolved.com.br
HTTP_USER_AGENTCCBot/2.0 (http://commoncrawl.org/faq/)
HTTP_X_FORWARDED_PROTOhttps
HTTP_X_FORWARDED_FOR23.22.136.56

ASP JavaScript

ASP JavaScript

  1. Section One: General Overview
  2. Section Two: Request and Response
  3. Section Three: Session, Application, and Includes
  4. Section Four: Server and ASPError
  5. Section Five: Databases (and form field validation)

MSDN Library

JScript Language Reference

  • Feature Information

    Provides links to topics that explain the features of JScript.

  • Errors

    Includes links to run-time and syntax errors.

  • Functions

    Provides a list of functions with links to information about each function.

  • Methods

    Provides a list of methods with links to information about each method.

  • Objects

    Provides a list of objects with links to information about each object.

  • Operators

    Provides a list of operators with links to information about each operator.

  • Properties

    Provides a list of properties with links to information about each property. /p>

  • Statements

    Provides a list of statements with links to information about each statement.

ASP/Javascript + Mootools 1.99dev.9784ebd4fade9e1194d6a90838c5527049e78506

Simple class

code result
var Simple = new Class({
    
    initialize: function(options){
        this.options = options;
    },
    
    property: "a property",
    
    method: function() {
        return "a method";
    }
    
});

var Instance = new Simple();
Response.write(Instance.property + '\n');
Response.write(Instance.method() + '\n');
a property
a method

Extended class

code result
var Extended = new Class({ Extends: Simple,
    
    initialize: function(options) {
        this.parent(options);
        this.extended = "extended property";
    }
    
});

var Instance = new Extended();
Response.write(Instance.extended + '\n');
Response.write(Instance.property + '\n');
Response.write(Instance.method() + '\n');
extended property
a property
a method

Implement class

code result
Extended.implement({
    
    implemented: "implemented property"
    
});

Response.write(Instance.implemented + '\n');
Response.write(Instance.extended + '\n');
Response.write(Instance.property + '\n');
Response.write(Instance.method() + '\n');
implemented property
extended property
a property
a method