# [web] ASP + 400 Bad Request

This topic is 5013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am using Wise Installation System to make a registration page for my company. As the user installs our Product they enter their name and email and push register. Wise sends the data to an .asp page i created. (Wise sends using the Post Method) The error that returns whenever I use the program is'400 Bad Request'...but if I use a website to post the data, it works fine..I'm not sure if I have done something wrong in the script...or in Wise. here is what my page looks like
<%@ Language=VBScript %>
<html>
<%
On Error Resume Next

'Get the info from the Posted Data
Dim Name
Dim Email
Dim Reg
Name = Request.Form("un")
Email = Request.Form("mail")
Reg = "blah" 'not used yet

PW="pass"
DB="thedatabase"
DBSERVER="server.com"
'Specifying to use the OleDB Data provider
DRIVER="Provider=sqloledb"

'Connect to the Database
ConnString =DRIVER&";SERVER="&DBSERVER&";UID="&UN&";PWD="&PW&";DATABASE="&DB
objConn.Open ConnString

'If there's an error, display there was, although it doesn't matter because when people register, they won't
If Err.Number <> 0 Then
Response.Write("<h1>There was an error connecting, but you shouldn't see this message anyway..</h1>")
Else
Response.Write("<h1>Connected to the Database successfully</h1>")
End If

Dim RecordSet

if Err.Number > 0 Then
Response.Write ( Err.Description )
Response.Write ("<br>")
Response.Write ( Err.Source )
Response.Write ("<br>")
Response.Write ( Err.number )
Err.Clear
Else
Response.Write("All Good")
End If

RecordSet("Name") = Name
RecordSet("Email") = Email
RecordSet("Reg") = Reg

RecordSet.Update()

RecordSet.Close
Set RecordSet = Nothing
'Close the connection
objConn.Close()
Set objConn = Nothing

%>

<body>
</body>

</html>



##### Share on other sites
Before I read through all the code looking for a bug, can you just clarify that you're trying to view an ASP page locally on a client computer? If so, are you sure that the computer has a webserver installed that can handle ASP? (IIS or PWS should suffice). You can't call an ASP page without a server to 'serve' it.

##### Share on other sites
The page is on a webserver that supports ASP, and i'm trying to run it from that webserver, it loads fine in the browser..

##### Share on other sites
Ok, I've looked through that code about a million times and can't find anything wrong with it. I think i'm going to assume that the problem is with Wise Installation System. If someone with a little more asp expierence than me (I've just gotton into vb script, just about a week now, so even obvious errors could be in there) could just look at that and confirm that it is all correct, I would be greatful

use php =p

##### Share on other sites
Ah, I forgot to reply earlier. A 400 error doesn't mean there's anything wrong with your script. I checked it over and it looks fine, with no obvious errors. What a 400 error means is that the client has attempted to send the server a bad HTTP request, perhaps the header is screwed up or something like that.

You said the error occurs only when using it through WISE as you've tested the page locally. It's a logical decision that the problem itself lies with WISE or the data that has been sent to the server in some way.

One possible way of debugging would to put a proxy between WISE and the server and read off the HTTP that's sent. Another would be to check your server logs to see if any indication is given as to the nature of the error.

Have you tried running the registration program on another machine connecting to your server?

Other than that, I'm stuck without being able to play around with it - do WISE have support forums? It may be worth looking for people that have had a similar problem.

##### Share on other sites
Yeah wise has forums, I posted but no one seems to know anything over that way. (Well they don't reply if they do anyway).

In Wise all I have to enter is basically the url and the text to post..

here is my text to post that I have

un=%NAME%
mail=%EMAIL%

In Wise to use Vars you must use the %varname%..I think I entere that right, as its suppose to go field=data

Thank you very much for all your help evolutional. I really like the proxy idea with seeing what is being sent. I just wish I knew how to do such a thing :-) researching it now.

Oh and yes, I have tried from another machine.

Oh and the guy that said use PHP. I would love to except I couldn't figure out how to connect to a sql server database. I couldn't find any info on OleDb or ODBC with PHP, just the damn mssql_connect..which the hosting company that we use doesn't have the right extensions installed for..(or something like that)
[/edit]

##### Share on other sites
Another thought, have you disabled the 'friendly errors' in IE? It'll give you more detailed error messages and perhaps highlight the exact cause of the error, including ASP line code if it's to do with that.

##### Share on other sites
"400 Bad request" is a client-side error.

It is caused by the CLIENT (in this case, your installer) NOT the .ASP script on the server, which is probably never even executed.

The most common cause that I've found, is broken clients sending spaces in the URL (which is of course illegal in HTTP). In some older web browsers this happened because the web page writer put spaces in the URL (illegally). The browser should have rejected it, but instead it sent it to the server anyway, which rejected it itself.

It's normal to urlencode strings being sent to the server in the URL- perhaps your client software isn't doing that properly.

Get a sniffer and see what request is being sent. I normally use Ethereal.

Mark

• 10
• 18
• 14
• 18
• 15