How do I suppress "friendly error messages" in Internet Explorer?

I want to display a custom error page:

<!doctype html>
<html>
<head><title>400 Bad Request</title></head>
<body><h1>400 Bad Request</h1>
The grob must be in the frobber.
</body>
</html>

Unfortunately, Internet Explorer ignores the response sent by the HTTP server; hiding my page and showing their own:

How can I convince Internet Explorer to show the page the user was sent?

Answers


The solution is PADDING.

Microsoft notes in knowledge base article KB294807:

HOW TO: Turn Off the Internet Explorer 5.x and 6.x "Show Friendly HTTP Error Messages" Feature on the Server Side

...these "friendly" error messages are only displayed if the response that is sent to the client is less than or equal to a specified threshold. For example, to see the exact text of an HTTP 500 response, the content length must be greater than 512 bytes.

Implement this padding. To do this, use the VBScript String function to return a string of the same character, which is one more than the ErrorThreshold that Internet Explorer 5.x uses to display the friendly error message. For example, add the following line immediately before the tag of 500-100.asp:

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

So i bulk up response page to:

<!doctype html>
<html>
<head><title>400 Bad Request</title></head>
<body><h1>400 Bad Request</h1>
The grob must be in the frobber.

<!--       
    512 bytes of padding to suppress Internet Explorer's "Friendly error messages"

    From: HOW TO: Turn Off the Internet Explorer 5.x and 6.x "Show Friendly HTTP Error Messages" Feature on the Server Side
          http://support.microsoft.com/kb/294807

    Several frequently-seen status codes have "friendly" error messages 
    that Internet Explorer 5.x displays and that effectively mask the 
    actual text message that the server sends.
    However, these \"friendly\" error messages are only displayed if the 
    response that is sent to the client is less than or equal to a 
    specified threshold.
    For example, to see the exact text of an HTTP 500 response, 
    the content length must be greater than 512 bytes.
  -->
</body>
</html>

Problem solved.

Bonus Reading

What makes IE decide to show a friendly error page?

The answer is that the server’s response must meet two criteria:

  • The HTTP Status code must be [400, 403, 404, 405, 406, 408, 409, 410, 500, 501, 505]
  • The HTTP Response body’s byte length must be shorter than a threshold value

The byte length thresholds are stored in the registry in HKEY_LOCAL_MACHINE under the subkey \SOFTWARE\Microsoft\Internet Explorer\Main\ErrorThresholds.

  • [403, 405, 410]: 256 bytes
  • [400, 404, 406, 408, 409, 500, 501, 505]: 512 bytes
  • otherwise: 512 bytes

Need Your Help

EditText Label?

android android-edittext

I want to have some layout a bit like this

How does strtok() split the string into tokens in C?

c string split token strtok

Please explain me the working of strtok() function.The manual says it breaks the string into tokens. I am unable to understand from the manual what actually it does.