Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 2002

Informant: Disabling Friendly HTTP Error Messages

RSS
Subscribe to Windows Web Solutions | See More Internet Explorer (IE) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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.

End of Article



Reader Comments
Actually, I have been using a different solution since IIS 5 came out. I copy the 500-100.asp file from deep in the system32 directory to a new directory in wwwroot called "error". IUSR_machinename needs read access to that dir. Then in the IIS settings, go to the Custom Errors tab (this can be done globally for all sites OR per-site) and set the 500 HTTP Error to go to "/error/500-100.asp". For every site that you host that you want to offer detailed error messages, just create a virtual directory called "error" and point it to the dir you created in wwwroot.
In terms of easiness, this is similar to your solution. But what if MS decides to "fix" that 512-byte workaround and make it a meg or something? And this solution definitely beats that crazy ISAPI "solution" that MS wants you to build.
Thanks for your newsletter. I have been receiving it for a long time and I greatly enjoy it. About every 2 or 3 issues, you have a tip or link or story that really blows my mind. You are incredibly helpful to the web dev community. Thanks!

Jason Berry May 21, 2003


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 24, 2008

An often irreverent look at some of the week's other news, including a Vista Capable dismissal request, Zune price reductions, Morrow musings, Novell and Microsoft sitting in a tree ... two years later, Yahoo!, IE 6 on Windows Mobile, and so much more ...


Related Events Delivering Reliable and Effective Web-Based Applications

Making Web Application Perform Better: What to Watch, How to Watch It, and How to Fix It

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing