PDA

View Full Version : 500 Internal Server Error



himannv
04-20-2007, 12:13 PM
Hi I'm quite new to ASP and I'm stuck. Basically I'm loading data into a database from a form. This works perfectly in the localhost but once I move onto the live site and upload it it gives me a 500 Internal Server Error.. (quite vague lol)

I tried to make this error more specific by changing the value in the Tools/Internet Options/Advanced tab. I also changed this setting on IIS (Home Directory/Configuration).. Still no luck!! The worst bit is that the server is located in another site and its difficult to get at these people.. Any help would be really good.. For instance if someone could tell me exactly what settings I should make in the server it would be great!! Thanks

techno_race
04-21-2007, 03:53 AM
Hmm... I've seen several of those at PuzzleMaker (http://www.puzzlemaker.com). And it just happened to be written in ASP. Weird. Can't help you there.

codeexploiter
04-23-2007, 04:18 AM
Have a look at these articles

http://classicasp.aspfaq.com/general/why-do-i-get-a-500-internal-server-error-for-all-asp-errors.html
http://www.idautomation.com/kb/http500error3.html

himannv
04-23-2007, 05:20 AM
Thanks for the replys guys.. Actually I've seen both the sites you suggested codeexploiter. I tried it but no difference in the error. The worst thing is it works in localhost but not on the live site..

codeexploiter
04-23-2007, 06:11 AM
Can you provide the code that you are using.

himannv
04-23-2007, 07:21 AM
This is the asp code. Check for html code below

<&#37;@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'declare your variables
Dim name, email, comments
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
name = Request.Form("name")
email = Request.Form("email")
comments =Request.Form("comments")

'declare SQL statement that will query the database
sSQL = "INSERT into users_tbl (name, email, comments) values ('" & name & "', '" & email & "', '" & comments & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("users.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

response.write "The form information was inserted successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>
</body>
</html>






And this is the rather simple html code..


<html>
<head>
<title>Form to Database</title>
</head>
<body>
<!-- comment - start the HTML form and use a HTML table for formatting-->
<form name="form1" action="quiz.asp" method="post">
<div align="center">
<table width="80%" border="0">
<tr>
<td>Name :</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>Email :</td>
<td> <input type="text" name="email"></td>
</tr>
<tr>
<td>Comments :</td>
<td><textarea name="comments"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="submit details" name="submit"></td>
</tr>
</table>
</div>
</form>
<!-- end the HTML form-->
</body>
</html>

codeexploiter
04-23-2007, 09:10 AM
As you said your code is working without any problem.

Have your tried any database connection method other than OLE DB. Specifically have you tried the following:

(1) ODBC based method (Data Source Name - DSN method)
(2) DSN Less connection method

Comment the following line in your code


sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("users.mdb")

Insert this code just after the above line in your source code - This one is a DSN less method. Just want to know whether this one works for you


sConnString="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("users.mdb")& ";"

save the files and try it

himannv
04-23-2007, 09:21 AM
I get an error as follows

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/quiz.asp, line 29

codeexploiter
04-23-2007, 09:29 AM
I think you don't have sufficient privileges for inserting the record(s) into the database you are referring in your code.

As you've mentioned the code works correctly even in my PC too because we have sufficient privileges to insert the data into the database but unfortunately your web host hasn't set enough permissions for you to do the insertion.

Read this article in which they've explained how you can set permission in your resources.

http://www.webwizguide.info/asp/faq/server_permissions.asp