HOWTO: Use MTS to Trap Error 'ASP 0113' Script Timed Out

Last reviewed: March 5, 1998
Article ID: Q182036
The information in this article applies to:
  • Microsoft Visual InterDev, version 1.0
  • Active Server Pages
  • Microsoft Transaction Server 2.0

SUMMARY

In a production environment, it is common to trap any errors that occur in your Active Server Pages (ASP) page using the statement "On Error Resume Next." However, if a script time-out error occurs, it is not possible to trap that error using this method.

If, however, you make the ASP page transactional, you will be able to, in essence, handle the error. When the script time-out occurs, the transaction will have failed, and if you made any changes to a resource that supports transactions, such as SQL server, the changes will be rolled back. In addition, your ASP page can contain a procedure named OnTransactionAbort() that will execute when the transaction fails, even if the failure was due to a time-out, or other error in that ASP page.

MORE INFORMATION

Transactional ASP pages must be hosted on Internet Information Server 4.0 or higher. To make an ASP page transactional, the page must contain the "TRANSACTION=required" argument in the @ Directives tag on the first line of the page.

The following code sample demonstrates trapping the script time-out error:

   <%@ TRANSACTION=Required LANGUAGE="VBScript" %>
   <HTML>
   <HEAD>
   <TITLE>Simple Transactional Web Page</TITLE>
   </HEAD>
   <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
   <font size="4" face="Arial, Helvetica">
   <b>Transactional Web Page</b></font><br>
   <hr size="1" color="#000000">
   <p>
   This is an example of an Aborted Transaction.
   This transaction will abort due to a Script
   Time-out error, which is an error that you
   could not trap without a transaction.
   </p>
   <p>
   Please wait until the script times out...
   </p>

   <%
     Do while 1 = 1
       'Infinite Loop
     Loop
   %>
   </BODY>
   </HTML>
   <%
    ' The Transacted Script Abort Handler. This sub-routine
    ' will be called if the script transacted aborts

     Sub OnTransactionAbort()
       Response.Write "<p><b>The Transaction just aborted</b>."
       Response.Write "This message came from the "
       Response.Write "OnTransactionAbort() event handler."
     end sub
   %>

REFERENCES

Additional samples of ASP functionality can be found in the Windows NT Option Pack Documentation. This documentation is installed by default and can be accessed from your Web server at the following location:

   http://localhost/iishelp/iis/misc/default.asp


For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/vinterdev/

Keywords          : VIASP VIScripting VIServer kbcode
Technology        : kbInetDev
Version           : WINDOWS:1.0; WINNT:2.0
Platform          : WINDOWS winnt
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.