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.


gangstafm

34 posts

Geek


#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 !
 




"Some are born great, some achieve greatness and some have greatness thrust upon them"



CPU : Intel Core Duo E6420 @ 2.13GHz •  Abit FP-IN9 SLI (FATAL1TY)
2GB RAM • 500GB HDD • 512mb NVIDIA GeForce 8800GTS Alpha Dog
Monitor : LG 32" LCD • OS: Windows XP - Windows 7 Viena SP 3 • ISP: Orcon+


Create new topic
gangstafm

34 posts

Geek


  #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 !




"Some are born great, some achieve greatness and some have greatness thrust upon them"



CPU : Intel Core Duo E6420 @ 2.13GHz •  Abit FP-IN9 SLI (FATAL1TY)
2GB RAM • 500GB HDD • 512mb NVIDIA GeForce 8800GTS Alpha Dog
Monitor : LG 32" LCD • OS: Windows XP - Windows 7 Viena SP 3 • ISP: Orcon+




freitasm
BDFL - Memuneh
80646 posts

Uber Geek
+1 received by user: 41026

Administrator
ID Verified
Trusted
Geekzone
Lifetime subscriber

  #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.





Referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies 

 

Support Geekzone by subscribing (browse ads-free), or making a one-off or recurring donation through PressPatron.

 


gangstafm

34 posts

Geek


  #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.




"Some are born great, some achieve greatness and some have greatness thrust upon them"



CPU : Intel Core Duo E6420 @ 2.13GHz •  Abit FP-IN9 SLI (FATAL1TY)
2GB RAM • 500GB HDD • 512mb NVIDIA GeForce 8800GTS Alpha Dog
Monitor : LG 32" LCD • OS: Windows XP - Windows 7 Viena SP 3 • ISP: Orcon+




freitasm
BDFL - Memuneh
80646 posts

Uber Geek
+1 received by user: 41026

Administrator
ID Verified
Trusted
Geekzone
Lifetime subscriber

  #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).




Referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies 

 

Support Geekzone by subscribing (browse ads-free), or making a one-off or recurring donation through PressPatron.

 


freitasm
BDFL - Memuneh
80646 posts

Uber Geek
+1 received by user: 41026

Administrator
ID Verified
Trusted
Geekzone
Lifetime subscriber

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




Referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies 

 

Support Geekzone by subscribing (browse ads-free), or making a one-off or recurring donation through PressPatron.

 


gangstafm

34 posts

Geek


  #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?




"Some are born great, some achieve greatness and some have greatness thrust upon them"



CPU : Intel Core Duo E6420 @ 2.13GHz •  Abit FP-IN9 SLI (FATAL1TY)
2GB RAM • 500GB HDD • 512mb NVIDIA GeForce 8800GTS Alpha Dog
Monitor : LG 32" LCD • OS: Windows XP - Windows 7 Viena SP 3 • ISP: Orcon+


Create new topic








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.