<p>I am implementing a HttpRequestValidationException in my Application_Error Handler, and if possible, I want to display a custom message.</p>
<p>Now, I'm thinking about the StatusCode. In my current example, it sends a 200, which I think should not be done. I would like to send the (IMHO) more appropriate 400 Bad Request instead. However, at the same time, I would like to use Response.Write to enter a custom message. Firefox displays it properly, but IE7 gives me the Default unhelpful Internet Explorer Error Page.</p>
<p>On one side, I guess that Internet Explorer just assumes that everything &lt;&gt; 200 is simply not having any &quot;good&quot; content, and the <a href="https://www.rfc-editor.org/rfc/rfc2616#section-10.4.1" rel="nofollow noreferrer">RFC is not really clear</a> here.</p>
<p>So I just wonder, is sending a HTTP 200 for an Error Page caused by a HttpRequestValidationException good practice or not? Are there good alternatives?</p>

[{'answer_id': 50779, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 1, 'selected': False, 'text': "<p>No, it's certainly not a good practice. 2XX status codes mean (among other things) that the <strong>request is valid</strong>. Which is just the contrary to raising a HttpRequestValidationException.</p>\n\n<p>I don't know how to make IE behave correctly, sadly. A slightly better way than to send a 200 would be to redirect it to an error page, but still far from perfect.</p>\n"}, {'answer_id': 50803, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 1, 'selected': False, 'text': '<p>Internet Explorer shows what they call a "friendly HTTP error message" when the response is 4xx or 5xx. This option can be turned off by the user in IE\'s Tools.Options.Advanced[Browsing] dialog. </p>\n\n<p>Sending a 200 for an error page is generally bad practice. One alternative would be to have a valid "Error" page that\'s <em>supposed</em> to show error messages (so a 200 would be okay) and then use a 3xx redirect to that page.</p>\n'}, {'answer_id': 50812, 'author': 'John Rutherford', 'author_id': 3880, 'author_profile': 'https://Stackoverflow.com/users/3880', 'pm_score': 3, 'selected': True, 'text': '<p>An HTTP 200 Response Code does not indicate an error.  It indicates that everything was OK.  You should not use a 200 response code for an error.  </p>\n\n<p>Internet Explorer shows its "Friendly Errors" page if the response is less than 512 bytes.  Here\'s more on this issue: <a href="http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx</a>,</p>\n'}]
['https://Stackoverflow.com/questions/50747', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/91/']