/egilh

Learning by doing

How to fix ASP.NET HTTP 400 error Bad Request errors

Posted on Thursday, April 27, 2006 12:52 PM

I was working on a system that proxied external contents when I got 400 Bad Request errors for file names with a double period; file..jpg. IIS handled the requests just fine as /dir/file..jpg worked but ASP.NET bombed when I requested /dir/proxy.aspx/file..jpg :

HTTP/1.1 400 Bad Request
Connection: close
Server: Microsoft-IIS/6.0
Content-Type: text/html

<html><body>Bad Request</body></html>

Microsoft Knowledge Base article 826437 explains how to fix it:

  • Install .NET 1.1 Service Pack 1
  • Set the following DWORD registry value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET VerificationCompatibility = 1

You also get a 400 Bad Request error if the url contains other reserved characters like colon http://server/folder/file.aspx/http://www.anothersite.com/

The syntax /dir/file.apx/something/else/here/123 is useful in many cases. Browsers do not see the url as "dynamic" as it does not contain a question mark so they are more likely to cache the output. The url can also be made shorter, which is important for mobile devices, as it does not have to urlencode all special characters.




Feel free to drop a few cents in the tip jar if this post saved you time and money

Feedback

# re: How to fix ASP.NET HTTP 400 error Bad Request errors

7/18/2008 10:58 AM by mary

how to fix 400 bad request?


# re: How to fix ASP.NET HTTP 400 error Bad Request errors

11/14/2008 8:31 AM by awrad

oo


Post Comment
Title
 

Name
 

Url

Protected by Clearscreen.SharpHIPEnter the code you see:
Comment