You may be seeing this error, usually when testing your working site in Netscape for the first time:
HTTP Error 400 400 Bad Request Due to malformed syntax, the request could not be understood by the server. The client should not repeat the request without modifications. |
Or, more simply:
You might also see ASP 0101 errors in the event log.
Well, there are a variety of possible reasons for this problem.
- make sure your form tag has a name, method and action:
| <form name="myForm" action="otherPage.asp" method="POST"> |
- make sure all of your <INPUT> and <SELECT> elements are given proper name values, and that the names do not contain illegal URL characters such as spaces and punctuation;
- try removing any charset definition in your page, e.g.:
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
- make sure your form tag only has an enctype specified if you are uploading binary data / files; I have seen the following tag on many forms that produce this 400 error:
| <form ... enctype="application/x-www-form-urlencoded"> |
- if you are uploading a file, make sure that you *have* specified an enctype, e.g.:
| <form ... enctype="multipart/form-data"> |
...and that you are conforming to any maximum filesize that might be manually or inherently imposed by your application (e.g. IIS <= 5.0 could accept a maximum of 4 GB, but were usually configured for far less; IIS 6.0 has a maximum of 2 GB, and again, is usually configured for less);
- make sure that any file you are redirecting to or are trying to stream to the user using response.binarywrite, is "safe"... the file itself, and any querystring attached to the URL, should not contain any unsafe characters such as spaces. If the querystring values contain spaces, fix that using Server.UrlEncode. For example, instead of this:
<% Response.Redirect "foo.asp?q=a b" %> |
Do this:
<% Response.Redirect "foo.asp?q=" & Server.URLEncode("a b") %> |
(Also, make sure that the target page of a form or response.redirect is not an ASP page with spaces in the name.)
Still no luck? Check the source and target pages against an HTML validator; hopefully they will turn up something:
W3C Validator HTMLHelp Validator