In Part 1 we looked at the two new methods of the
Transfer. Also new to
ASP 3.0 is a brand new intrinsic object, the
(view the technical
docs) - This new, intrinsic object provides a graceful error handling not available in
earlier versions of the ASP engine. Previously, handling ASP errors was impossible. You
could catch scripting errors using VBScript's
On Error Resume Next, or using
try ... catch blocks, but you could not trap errors that occurred
in COM objects, or intrinsic ASP errors. That has all changed with the advent of the
To utilize this object, first you need to customize the custom HTTP errors within IIS.
When an ASP-related error occurs, the HTTP error
500;100 is triggered. In
IIS 4.0 you can trap HTTP errors, and, when they occur, you can have an ASP script execute.
(See Creating a Custom 404 Error Page for information
on how to trap the HTTP 404 Error using IIS 4.0.) With IIS 5.0, you can trap the
HTTP error, and, when it occurs, have the user redirected to an ASP script.
This ASP script can access the
ASPError object to determine the specifics of
the error that just occurred. The
ASPError object has a number of
read-only properties that reveal detailed information on the last error. The
object contains a new method,
GetLastError, which must be used to obtain the
information on the latest ASP error. The
GetLastError method returns an instance
So, imagine that you created a default error handling script titled
You would need to setup your IIS web server such that when an HTTP
occurred, the user was redirected to
CatchError.asp. Then, to display the
detailed information of the error that just occurred,
contain the following code:
You can read the technical
docs for a full listing of the
ASPError object's properties.
ASPError object, along with the
Server.Execute methods are the big additions to ASP 3.0. There are some
minor changes. For example, in ASP 2.0, by default,
Response.Buffer was set
False. In ASP 3.0,
Response.Buffer is set to
(Buffering output yields better performance.) Also, the ASP engine is more streamlined,
and more efficient.
That about wraps up the major changes. Of course, with ASP 3.0 comes the latest scripting engine versions for both VBScript and JScript. You can read about these at Microsoft's Scripting Site.