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 !
 

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 !



freitasm
BDFL - Memuneh
79270 posts

Uber Geek

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.





Please support Geekzone by subscribing, or using one of our referral links: Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSyncBackblaze backup


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.



freitasm
BDFL - Memuneh
79270 posts

Uber Geek

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




Please support Geekzone by subscribing, or using one of our referral links: Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSyncBackblaze backup


freitasm
BDFL - Memuneh
79270 posts

Uber Geek

Administrator
ID Verified
Trusted
Geekzone
Lifetime subscriber

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




Please support Geekzone by subscribing, or using one of our referral links: Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSyncBackblaze backup


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?

Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.