Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2004, 01:58 PM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default ASP Error Trapping and Reporting

Does anyone know of any simple code that can trap unhandles server errors? I want to just through a sub on a bunch of pages that trap any unhandled IIS errors that will create an email and notify me of the exact error message but I don't have the ability to edit the global.asa file or anything....

Anyone know of anything?
Reply With Quote
  #2 (permalink)  
Old November 6th, 2004, 05:29 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello kevokiran,

Do you have access to the server ? If yes, you can do the following.

Create a custom error page for the site. You can copy the basic template of the site and include error information into it to create one such page.

Here is a sample page.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>Error reported</title>
    </head>

    <body>
        <h3>This page has produced an error</h3>
        <p>The description of the error is given below.</p>
        <%
            Dim objASPError
            Set objASPError=Server.GetLastError
            Response.Write("<strong>Error number</strong> = " & objASPError.Number & "<br>")
            Response.Write("<strong>File</strong> = " & objASPError.File & "<br>")
            Response.Write("<strong>Line  number</strong> = " & objASPError.Line & "<br>")
            Response.Write("<strong>Column</strong> = " & objASPError.Column & "<br>")
            Response.Write("<strong>Description:</strong><br>" & Server.HTMLEncode(objASPError.Description) & "<br>")
        %>
    </body>
</html>
This is a bare minimum report. You can take a look at /iishelp/custom/500-100.asp to get all the properties of error object. You may mail this error to an address if you prefer.

Now, you have to configure IIS to use this file.

First upload the custom error page to a folder.

Open IIS Manager.

Rightclick the virtual directory corresponding to the site. Open properties.

Open the tab - custom errors.

Scroll down to the error 500;100. Edit it.

Choose the type as URL. Give the URL of your custom error page for that error. User the above file you created.

Now you can see, it shows the page you have created whenever an error happens.

If server is not in your control, you can create the file and upload it to a folder and request these configuration changes to server admin. (Best of luck !)

Hope this helps.

Madhu.
Reply With Quote
  #3 (permalink)  
Old November 9th, 2004, 12:46 PM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

You are the man! Thanks a million!

Reply With Quote
  #4 (permalink)  
Old June 2nd, 2007, 02:08 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How this can be done if my site is in shared hosting?

thanks
Dosth

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error reporting - oddity ab_dev Beginning PHP 1 March 13th, 2006 02:44 PM
error trapping majones@omaha Classic ASP Basics 0 January 5th, 2006 02:02 PM
Trapping Application Events ERROR MagicTH Excel VBA 1 August 14th, 2005 01:23 PM
Need some error trapping... cpk Classic ASP Databases 4 January 26th, 2005 08:10 AM
Error Trapping Steps jweyl SQL Server DTS 1 July 26th, 2004 05:59 PM



All times are GMT -4. The time now is 12:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.