Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




34 posts

Geek


Topic # 74916 10-Jan-2011 16:46 Send private message

Hi,

Hope you all had a good break…

I have a sample form page on a website right now.

It is called ‘form.htm’ and the information is sent using ‘contact.asp’. If the form is successfully sent then it should go to ‘ok.htm’ or else it should be going to ‘error.htm’.

www.gspprint.com.au/2301/form.htm


To check whether ASP works on the webserver I played around with some sample asp pages on the server (tizagForm.html) and it seems to be working fine but when I push submit on the ‘form.htm’ it gives me a HTTP 500 Internal Server Error  - “Most likely causes: The website is under maintenance, The website has a programming error.”
This is doing my head in....

I spoke to our technical team and they said that the webserver is running IIS6 – and ASP2.0.

Would it be possible for someone to please take a look at that?

Many thanks !
 

Create new topic


34 posts

Geek


  Reply # 425818 10-Jan-2011 17:14 Send private message

Sorry.. couldnt figure out how to edit the original topic...
Coding is attached in this one:

**************************************
Hi,

Hope you all had a good break…

I have a sample form page on a website right now.

It is called ‘form.htm’ and the information is sent using ‘contact.asp’. If the form is successfully sent then it should go to ‘ok.htm’ or else it should be going to ‘error.htm’.

Code for form.htm is as follows:

---------------------------------------------------------
<form method="POST" action="contact.asp">
Fields marked (*) are required

<p>Email From:* <br>
<input type="text" name="EmailFrom">
<p>Subject: <br>
<input type="text" name="Subject">
<p>Name:<br>
<input type="text" name="Name">
<p>Tel:<br>
<input type="text" name="Tel">
<p>Company:<br>
<input type="text" name="Company">
<p><input type="submit" name="submit" value="Submit">
</form>

------------------------------------------------------------

Code for contact.asp is as follows:

<%

' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Tel
Dim Company

' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "farhan.mirza@apn.co.nz"
Subject = Trim(Request.Form("Subject"))
Name = Trim(Request.Form("Name"))
Tel = Trim(Request.Form("Tel"))
Company = Trim(Request.Form("Company"))

' validation
Dim validationOK
validationOK=true
If (Trim(EmailFrom)="") Then validationOK=false
If (validationOK=false) Then Response.Redirect("error.htm" & EmailFrom)

' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Tel: " & Tel & VbCrLf
Body = Body & "Company: " & Company & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("ok.htm" & EmailFrom)
%>
----------------------------------------------------

When I push submit on the ‘form.htm’ it gives me a HTTP 500 Internal Server Error  - “Most likely causes: The website is under maintenance, The website has a programming error.”
This is doing my head in....

I spoke to our technical team and they said that the webserver is running IIS6 – and ASP2.0.

Would it be possible for someone to please take a look at that?

Many thanks !

BDFL - Memuneh
57451 posts

Uber Geek
+1 received by user: 9112

Administrator
Trusted
Geekzone
Subscriber

  Reply # 425823 10-Jan-2011 17:27 Send private message

Error 500 could be lots of things - including syntax errors.

On the server, open Event Viewer and you should be able to see the error listed.

Alternatively you can configured IIS to show you the errors and point out the line where it happened instead of a custom error page (the 500 you are seeing).

Why this is a good idea to leave the non-custom error showing? Because if something happens people can see your code and it would reveal a lot of how things work. So perhaps you want to have this on a test server.

Also "Response.Redirect("ok.htm" & EmailFrom)" will cause an error on runtime, since the server will tell the browser to redirect to "ok.html[whatever emailfrom here]", which will obviously cause an error 404 later.







34 posts

Geek


  Reply # 425827 10-Jan-2011 17:31 Send private message

thanks for that....

i dont think the techies would let me change the server setup...

do you think i should remove that line completely?

im not a web guru... i just wanted to create a simple form where a person could put in their details and it ended up to an email address..

Googling got me to this script which i added on here earlier.

Im creating the website using Frontpage 2003.

BDFL - Memuneh
57451 posts

Uber Geek
+1 received by user: 9112

Administrator
Trusted
Geekzone
Subscriber

  Reply # 425829 10-Jan-2011 17:32 Send private message

I've tested the link you posted. Here are the results:

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/2301/contact.asp, line 33

800401f3

It means the CDONTS is not installed on the server.

Also your code doesn't really validate email - it accepts anything, just not "empty". I would at the very least also collect IP address with Request.ServerVariables(REMOTE_ADDR).




BDFL - Memuneh
57451 posts

Uber Geek
+1 received by user: 9112

Administrator
Trusted
Geekzone
Subscriber

  Reply # 425831 10-Jan-2011 17:33 Send private message







34 posts

Geek


  Reply # 425834 10-Jan-2011 17:37 Send private message

Thanks.. Ive asked the server tech to install CDONTS & CDOSYS on the server.

Maybe i'll give it a go once that is done...and see what happens?

Create new topic



Amazon prices in US$






Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:






Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.