ONE Active Server Pages Product Home Page Developer Site Version


Remarks: ASP Server Object GetLastError Method

The correct functionality of the Server.GetLastError method depends on the behavior of the Web server. Because the dependent behavior is implemented only on Microsoft’s IIS Web server, and not on other Web servers such as the Apache Web Server or Sun ONE Web Server (formerly iPlanet), Sun ONE ASP is not in complete compliance with Microsoft ASP 3.0 functionality for this method.

On IIS, when an ASP page gets an unhandled error (parsing or run time), page control is transferred to a predefined error page. For 500:100 errors, this page is another ASP page that displays specific information about the error that was received. The error-handling page uses the Server.GetLastError method to retrieve the ASPError object to access specific information about the error that just occurred. When the unhandled error occurs, IIS relies on the Server.Transfer mechanism built into the ASP server to transfer control to the error-handling page.

Because the Sun ONE and Apache Web servers use their own mechanisms for displaying unhandled errors, that functionality is implemented inside the ASP Server. To implement this functionality, a directive has been added to the Sun ONE ASP Server’s configuration file (casp.cnfg). The directive tells the ASP server where to transfer control when an unhandled error occurs. The name of the new directive is 500errordocument=<path> and it is located in the [default application] section in casp.cnfg. There are two possible values for this directive. If the directive contains the path to a valid ASP or HTML file, that file will be returned when the ASP server encounters a 500 error. If the directive is left blank, the ASP server uses a custom 500 error page installed with the product.

The custom page installed with Sun ONE ASP is identical to the custom page installed with Microsoft IIS 5.0. When an unhandled error occurs on the Sun ONE ASP server, control is transferred (using the Server.Transfer method) to the page listed in casp.cnfg. This page uses the Server.GetLastError method to display detailed information about the error that just occurred.

In addition, a 500-15errordocument=<path> directive has also been added to casp.cnfg. When the browser requests the global.asa file and an error is encountered, the server redirects to this custom error page.

For more information about these casp.cnfg settings, see the settings listed in [default application].