ASP 3.0 new Features sneak peek (ii)

Source: Internet
Author: User
This article describes an entirely new built-in object ASPError object in ASP 3.0.
ASPError Object
This new, built-in and ASP 3.0 object provides a previous version of the
Specifically used to handle the wrong object, so that we can manipulate the error to be possible.
Previously you could use the on Error Resume next or JScript in VBScript to try ... Catch to catch the error,
But you cannot capture a COM object, or an error that occurs in a built-in ASP object
But if you use the ASPError object, then everything will be possible to change.

To use this object, the first thing we need to do is to customize the HTTP error message in IIS (how do I say no more
10 times, hehe. )。 This triggers the HTTP error 500;100 when an ASP-related error message occurs.

Then in the ASP script you can access the ASPError object to determine exactly what is wrong.
The ASPError object has a series of read-only properties to get the details of the last error.
This service-side object contains a new method GetLastError that must be used to obtain the occurrence of the
Error message.

Now let's take the example to illustrate the problem, assuming that the script file used to handle the error is catcherror.asp.
You should first set the HTTP 500;100 in the custom error message for IIS to reposition with catcherror.asp.
The error message is then displayed in its own way, as follows: following code:
<%
Dim Objlastasperror
Set Objlastasperror = Server.GetLastError
%>

Caught an error:<br>
Error description: <%=objLastASPError.Description%><BR>
Error Category: <%=objLastASPError.Category%><BR>
Error file: <%=objLastASPError.File%><BR>
Error Number: <%=objLastASPError.Number%><BR>


ASPError objects, Server.Transfer, Server.Execute are new in ASP 3.0
Content. Of course, there are some other minor changes. For example, the default Response.Buffer in ASP 2.0 is set to False.
In ASP 3.0, Response.Buffer is set to True by default.

Of course, the latest version of the scripting engine (both VBScript and JScript) comes with ASP 3.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.