0

Hi there and sorry in advance for a pretty bad question.

Without any proper asp.net experience, I have been asked by a friend to fix an issue with a pretty old/horrible website.

The issue is, that when the website is hosted, specifically on Plesk (shouldn't matter tho), if anyone tries to submit the contact us form, an internal server error is triggered. Oddly enough, after creating a project locally and running the server on my machine, everything seems to work fine.

The form header is the following.

<form name="form5" method="POST" action="feedbackcl.asp" onsubmit="javascript:return validateForm(this);">

The validateForm, is a rather straightforward JS function, nothing crazy there:

<script language="JavaScript">

        function Juge5(theForm1) {

            if (form5.iname.value == "") {
                alert("Please provide a name.");
                form5.iname.focus();
                return (false);
            }
            if (form5.tel.value == "") {
                alert("Please provide a phone number.");
                form5.tel.focus();
                return (false);
            }
            if (form5.email.value == "") {
                alert("Please provide an E-mail.");
                form5.email.focus();
                return (false);
            }
            if (form5.neirong.value == "") {
                alert("Please insert a message");
                form5.neirong.focus();
                return (false);
            }
        }
    </script>

Adding a few console logs, what I noticed is that the whole following script (feedbackcl.asp) is never even called. A fairly generic error message is instead displayed, saying that the page cannot be displayed.

<%   
validateCode1=request("validateCode")

set conn=server.createobject("adodb.connection")           
pro="provider=microsoft.jet.oledb.4.0;"           
dbpath="data source="& server.mappath("data/database.mdb")           
conn.open pro&dbpath                    
set rs=server.createobject("adodb.recordset")
sql="select * from huangtable"                 
rs.open sql,conn,3,3    


if session("validateCode")<> validateCode1 then
    response.write"<SCRIPT language=JavaScript>alert('Message Error!');"
    response.write"this.location.href='contact.asp';</SCRIPT>" 
    response.end

else
    rs.addnew
    rs("FirstName")=request("iname")
    rs("tel")=request("tel")
    rs("email")=request("email")
    rs("icontent")=request("neirong")
    rs("idate")=now()
rs.update

response.write"<SCRIPT language=JavaScript>alert('Send Sucess');"
response.write"this.location.href='index.asp';</SCRIPT>" 

end if
%>

Any suggestion would be welcome, as I am already way too tempted to simply re-write everything with React :D

Thanks!

sh1rts
  • 1,874
  • 1
  • 13
  • 14
Eloh666
  • 23
  • 1
  • 6
  • Is the 'internal server error' a 500 error? It's no suprise it works locally. It could be for example that your MDB can't be opened for some reason (on the server). One way to troubleshoot is got to the F12 window and check the network tab and see if there are any more errors there. Note: a javascript library like react is not going to help fix a 500 error, which is a back end error. Does this help you find more info on the server error: https://support.plesk.com/hc/en-us/articles/213955585--HUB-500-Internal-Server-Error – Nick.Mc Apr 10 '17 at 01:09
  • Hi there, yes it is an internal server error, which simply says "There is a problem with the resource you are looking for, and it cannot be displayed." – Eloh666 Apr 10 '17 at 10:17
  • Regarding the network tab, it does simply provide the error when trying to load the resource "feedbackcl.asp", it does not seem to be a problem related to the DB not working. Locally, I had simply wrapped it all into an asp.net project and ran it on VS2015, but I understand what you mean. – Eloh666 Apr 10 '17 at 10:19
  • 1
    The first thing you need to do is to enable detailed error messages, then you can see what the error is and on what line of code it's occurring. This question might help. http://stackoverflow.com/questions/2640526/detailed-500-error-message-asp-iis-7-5. If you have to use Plesk and you don't have an RDP connection to your server then the second answer is probably the most useful. – John Apr 11 '17 at 08:44

0 Answers0