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
58098 posts

Uber Geek
+1 received by user: 9634

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
58098 posts

Uber Geek
+1 received by user: 9634

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
58098 posts

Uber Geek
+1 received by user: 9634

Administrator
Trusted
Geekzone
Subscriber



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



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:





News »

Red Hat unveils production-ready open source hyperconverged infrastructure
Posted 23-Jun-2017 22:10


Whatever ailed Vodafone broadband … seems to be fixed
Posted 23-Jun-2017 14:10


VMware NSX Meets Stringent Government Security Standards with Common Criteria Certification
Posted 22-Jun-2017 19:05


Brother launches next-generation colour laser printers and all-in- ones for business
Posted 22-Jun-2017 18:56


Intel and IOC announce partnership
Posted 22-Jun-2017 18:50


Samsung Galaxy Tab S3: Best Android tablet
Posted 21-Jun-2017 12:05


Wellington-based company helping secure Microsoft browsers
Posted 20-Jun-2017 20:51


Endace delivers high performance with new 1/10/40 Gbps packet capture card
Posted 20-Jun-2017 20:50


You can now integrate SMX security into Microsoft Office 365, Google and other cloud email platforms
Posted 20-Jun-2017 20:47


Ravensdown launches new decision-making tool HawkEye
Posted 19-Jun-2017 15:38


Spark planning to take on direct management of all consumer stores
Posted 19-Jun-2017 10:03


Qrious acquires Ubiquity
Posted 14-Jun-2017 12:21


Spark New Zealand prepares for 5G with Nokia
Posted 14-Jun-2017 12:16


The future-proof 10.5-inch iPad Pro
Posted 13-Jun-2017 18:16


Mandatory data breach reporting in Australia
Posted 13-Jun-2017 11:30



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.