When my Web applications produce an error, the client often sees only the generic HTTP 500 error without any supporting details. Of course, this lack of detail makes troubleshooting difficult. Telling users to disable Show friendly HTTP error messages in Microsoft Internet Explorer (IE) works, but doing so is difficult to manage on a client-by-client basis. What can I do on the server side to change this IE setting?

When the friendly messages feature in IE 5.x or later is enabled, IIS delivers error messages, but IE shows friendly error messages rather than those messages the Web server delivers. When you disable the feature in IE, you're in effect telling IE to show what the server is delivering. (You disable the feature in IE by selecting Tools, Internet Options; clicking the View tab; then clearing the Show friendly HTTP error messages option.)

You could deliver to the client a script, object, or executable that changes the appropriate registry setting. However, because doing so involves a high degree of trust by the client to let you make the changes, this process is almost as problematic as walking users through making the change manually. The trick is to get IE to show the error messages without having to modify the client.

IE's friendly error messages don't kick in if the number of bytes from the server's error message exceeds a certain threshold (by default, 512 bytes). Thus, if you create a custom message that exceeds 512 bytes, IE will show the custom message, complete with all the error information. (See the Microsoft article "Creating Custom ASP Error Pages" at http://support.microsoft.com/default.aspx?scid=kb;en-us;q224070 for tips about creating informative error pages.) One way to create such a custom message is simply to pad the 500;100 error page that resides in \iishelp\common\500-100.asp with enough characters that the enlarged error message exceeds IE's 512 byte threshold. To do so, add

<% Response.Write String(513, "_") %>

before the .asp file's <Body> tag.

However, in the case of some internal server errors, IIS won't deliver your custom page. The only workaround is to install an Internet Server API (ISAPI) filter to implement the padding for you. The Microsoft article "HOWTO: Disable Internet Explorer 5 'Show Friendly HTTP Error Messages' Feature on the Server Side" (http://support.microsoft.com/default.aspx?scid=kb;en-us;q294807) has a reference to such a filter.