How Do I Get Detailed Information About Errors in ASP or ASP.NET Pages?

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:

An HTTP 500 Error as Displayed in Internet Explorer with Friendly Errors Turned On
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:

An Error Message You May See when Detailed Error Messages is Disabled in IIS
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.

Good Morning, I am your Friendly HTTP Error Message for the Day

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.

The Advanced Tab of the Internet Explorer Options dialog
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:

The Full Error Message is Much More Useful. It Provides the Detailed Information You Need to Track the Problem
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

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:

  1. Start the Internet Information Services management console, which you'll find the under Administrative Tools which in turn you'll find either directly on the Start Menu, or in the Windows Control Panel.

    The IIS Management Console
    Figure 5 - The IIS Management Console

  2. Expand the tree in the left hand pane until you see Default Web Site. If you're configuring another Web site, or a Virtual Directory / Application, locate that one instead. This article assumes you're configuring the Default Web Site, so make sure you adjust any steps to match your situation if necessary.

  3. Right-click the Default Web Site in the tree at the left and choose Properties.

  4. Open the Home Directory tab (or Directory tab in case of a Virtual Directory) then click the Configuration button.

  5. On the Application Configuration dialog, switch to the Debugging tab and you'll see the following screen appear:

    The Application Configuration Dialog with Detailed ASP Error Messages Turned On
    Figure 6 - The Application Configuration Dialog with Detailed ASP Error Messages Turned On

  6. On your development machine, make sure that Send detailed ASP error messages to client is turned on. As soon as you put your site in production, switch to the other option and, if you prefer, provide a custom error message.

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.

Related Articles

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:

Where to Next?

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.

Feedback by Other Visitors of Imar.Spaanjaars.Com

On Wednesday, April 6, 2005 1:17:56 AM Dinesh said:
Thanks for the article.  I have been searching for the past couple of hours on how to get the detailed error instead of the usual http 500 error.  Thanks again.

On Thursday, September 21, 2006 7:34:05 PM Jim Bo said:
Another technique for seeing detailed errors, is to go to IIS , Properties, Custom Errors, select "500;100" edit , Default, OK, Apply.

On Sunday, January 14, 2007 4:57:56 AM Richard Crowley said:
I just upgraded to Explorer 7 and even with friendly error messages turned off, the result is a dumbed-down simplified mess. Is there any way out of this, or should I rebuild my PC and go back to Explorer 6?
On Sunday, January 14, 2007 11:19:33 AM Imar Spaanjaars said:
Hi Richard,

It works for me in IE 7. Are you sure your server is setup to deliver detailed error messages?

BTW, no need to rebuild. AFAIK, IE can be uninstalled, although I don't think that's needed in this case.

On Sunday, January 14, 2007 2:56:23 PM Richard Crowley said:
Thanks, Imar

This appears on EVERY server. In IE6, I get resonable error messages. On the same URL in IE7, even with "Show friendly HTTP error messages" turned OFF, I am getting a dumbed-down boilerplate of "things to check" and something approaching the actual error message burried down under a couple of mouse-clicks.  It is really disgusting. I am going to go back to IE6 if there is no way out of this rubber room. :-((
On Sunday, January 14, 2007 3:21:05 PM Imar Spaanjaars said:
Hi Richard,

Very weird; it's supposed to work. I have seen a few other reports on this with IE7, but I haven't found a solution. Please post a follow up if you do find the solution, other than uninstalling IE 7 ;-)

On Sunday, January 14, 2007 5:01:08 PM Richard Crowley said:
It appears that I am ALWAYS seeing the friendly (i.e. dumbed-down) error messages. IE7 seems to ignore my setting for "View Friendly HTTP Error Messages"  It doesn't matter whether it is turned on or off, IE7 always shows the "friendly" error message.

I have posted my problem(s) (and a followup about the option not working) to news:microsoft.public.internetexplorer.general but without response so far.
On Sunday, January 14, 2007 5:07:03 PM Imar Spaanjaars said:
Hi Richard,

Thanks for the update; hopefully someone in the newsgorups has an answer....

On Tuesday, February 27, 2007 9:05:33 PM Donald King said:
I just upgraded to IE7 this week and have the same issue as described by Richard.  Did anyone ever find a fix for this??
On Wednesday, February 28, 2007 5:03:48 AM Richard Crowley said:
It is either a "known issue with no resolution" or actually a "feature"(!)  In either case, I gave up on IE7, removed it, and reverted back to IE6.  I'll look at it again in 6 months or so and see if they have come to their senses. I'm not holding my breath.  I draw the line at using software that is that stupid.
On Saturday, December 27, 2008 5:41:45 PM Richard Crowley said:
The friendly error message problem with IE7 continues unsolved. Despite numerous websites which advise simply un-checking the box in Internet Options (as above), EVERY computer I have tried this on steadfastly refuses to dump the friendly messages and render the actual error code. I am having a harder time avoiding IE7 as it now comes defaulted on new builds. I have given up on IE and switched to Google Chrome and Firefox. While they also show dumbed-down error messages, they ultimately reveal the actual error code under a click or two.  I am completely baffled how Microsoft could release something so remarkably stupid.  I am beginning to see what  the MS-bashers have been whining about all these years.
On Saturday, December 27, 2008 6:01:49 PM Imar Spaanjaars said:
Hi Richard,

Well, you better report this issue to Microsoft, rather than complain here. There's not much I can do, and I am pretty sure Microsoft is not watching this site for your comments.... ;-)

Alternatively, use something like Fiddler. Ever since I installed that, I haven't even cared about the way any browser displays its error messages....

On Monday, December 29, 2008 3:33:33 AM Richard Crowley said:
Thanks Imar,

I don't think there's any future in complaining to Microsoft. If it still operates the same now going on two years after release, I've got to believe that it isn't a *bug* but a *feature*. Microsoft apparently thinks their users are too stupid to understand real HTTP error messages.  I have switched to Chrome which at least still displays the actual error codes.

Talk Back! Comment on Imar.Spaanjaars.Com

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.