Petrolhead
Technical User
- Mar 13, 2009
- 27
Hi there,
I have resolved all other issues with my contct script script. I now get a 404 file not found error when I run it.
I believe this is due to a path error on the final response redirect in the code.
the thank-you.html file is in the root directory and the contact.asp script is in a folder named scripts.
I have tried the tilde and the .. method with no success, can anyone help?
I have resolved all other issues with my contct script script. I now get a 404 file not found error when I run it.
I believe this is due to a path error on the final response redirect in the code.
the thank-you.html file is in the root directory and the contact.asp script is in a folder named scripts.
Code:
<%
' declare variables
Dim EmailTo
Dim Subject
Dim Name
Dim EMailAddress
Dim Message
' get posted data into variables
EmailTo = "thomas_irvine@live.co.uk"
Subject = Trim(Request.Form("Subject"))
Name = Trim(Request.Form("Name"))
EMailAddress = Trim(Request.Form("Email"))
Message = Trim(Request.Form("Message"))
' validation
Dim validationOK
If (Trim(Name)="") Then
validationOK=false
ElseIf (Trim(Subject)="") Then
validationOK=false
ElseIf (Trim(Email)="") Then
validationOK=false
ElseIf (Trim(Message)="") Then
validationOK=false
Else validaionOK=true
End If
If (validationOK=false) Then
Response.Redirect("~/error.html")
Else
' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Subject: " & Subject & VbCrLf
Body = Body & "E-MailAddress: " & E-MailAddress & VbCrLf
Body = Body & "Message: " & Message & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.Subject = Subject
mail.Body = Body
mail.Send
' redirect to success page
Response.Redirect("~/thank-you.html")
End If
%>
I have tried the tilde and the .. method with no success, can anyone help?