| Details | ![]() |
| QuickDocId | 264 |
| Written by | Imar Spaanjaars |
| Posted | 03/31/2004 10:48 |
| Reviewed | 12/07/2006 17:23 |
| Page views | 15218 |
| Listened to | Incubus - In My Room from the album: A Crow left to the murder |
Are you looking to hire an experienced software developer or .NET consultant? Then get in touch with me through my company's web site at devierkoeden.com
Found an interesting article on this site? Got inspired by something you read here? Then consider making a donation with PayPal.
When you are trying to debug your ASP or ASP.NET pages, it's important to get detailed
information about your errors. Knowing the cause of the error is often
the biggest part of solving the problem.
By default, Internet Explorer will hide
most of the raw error message from you, and instead will give you a “Friendly” HTTP
error message. This FAQ will show you how to disable this feature so you
can see the original error that the ASP run-time threw at you. This will
help tremendously in debugging your ASP applications.
When you are creating ASP or ASP.NET pages, it's likely you have seen an error like the following when you requested a page in your browser:
Figure 1 - An HTTP 500 Error as Displayed in Internet Explorer with Friendly Errors Turned On
It's also possible to get error messages like this one:
Figure 2 - An Error Message You May See when Detailed Error Messages is Disabled in IIS
I think you'll agree with me that these error messages are not very descriptive. All they tell you is that something went wrong, but it is impossible to find out what went wrong.
The error message from the first screen shot is what the designers of Internet Explorer call a “Friendly HTTP Error Message”. For the majority of users, this is true. This error message tells them that something went wrong, and it offers them a link back to the homepage of the site. There is no need to bother ordinary visitors with technical gobbledygook.
But for you as a developer, this message is useless. Fortunately, it's easy to get more detailed information about the error: simply turn off the Friendly HTTP Error Message feature.
To turn that feature off, open the Internet Options dialog (choose Tools | Internet Options... in Internet Explorer) and switch to the Advanced tab. You'll find the Show friendly HTTP error messages setting under the Browsing category. Make sure the item is unchecked. 
Figure 3 - The Advanced Tab of the Internet Explorer Options Dialog
With the option turned off, you'll get a much more descriptive error message instead, like the next one, for example:
Figure 4 - The Full Error Message is Much More Useful.
From this error message, it's easy to see what went wrong; apparently, I forgot to create or upload the include file Adovbs.inc.
If you still don't see a detailed error message with the option in Internet Explorer turned off, but get an error like the one on the second screen shot instead, you should make changes to IIS as well. IIS offers you the option to either send detailed error messages to the client or to send a short custom message instead in case of an error. On a development server, the detailed error message is what you are really interested in. But on a production server, you don't want to send this information to the client; all you want to tell your visitor is that something went wrong. To make the change in IIS, follow these steps:
With both these options set to provide detailed error messages, debugging your ASP pages is now a lot easier. Instead of a general "Ooops, we screwed up" message, you are now able to see the cause of the error, so it's much easier to fix your problem.
Just don't forget to change the setting in IIS to Send text error message to client when you put your site in production. Your client is really not interested in the raw details of your errors.
On a production site, you could decide to send the user to a custom error page when an error occurs. That allows you to catch the error, send an e-mail to the Web master and explain to your user in plain English what went wrong. Check out the following articles for more information about this subject:
Wonder where to go next?
You can read existing comments below
or you can post a comment yourself on this article.
Consider making a donation
Please consider making a donation using PayPal. Your donation helps me to pay the bills so I can keep running Imar.Spaanjaars.Com, providing fresh content as often as possible.
I am interested in what you have to say about this article. Feel free to post any comments, remarks or questions you may have about this article. The Talk Back feature is not meant for technical questions that are not directly related to this article. So, a post like "Hey, can you tell me how I can upload files to a MySQL database in PHP?" is likely to be removed. Also spam and unrealistic job offers will be deleted immediately.
When you post a comment, you have to provide your name and the comment. Your e-mail address is optional and you only need to provide it if you want me to contact you. It will not be displayed along with your comment. I got sick and tired of the comment spam I was receiving, so I have protected this page with a simple calculation exercise. This means that if you want to leave a comment, you'll need to complete the calculation before you hit the Post Comment button.
If you want to object to a comment made by another visitor, be sure to contact me and I'll look into it ASAP. Don't forget to mention the page link, or the QuickDocId of the document.
For more information about the Talk Back feature, check out this news item.
| QuickDocId | 264 |
| Full URL | http://imar.spaanjaars.com/264/how-do-i-get-detailed-information-about-errors-in-asp-or-aspnet-pages |
| Short cut | http://imar.spaanjaars.com/264/ |
| Written by | Imar Spaanjaars |
| Date Posted | 03/31/2004 10:48 |
| Date Last Reviewed | 12/07/2006 17:23 |
| Listened to when writing | Incubus - In My Room from the album: A Crow left to the murder |