CdnGal
03-06-2003, 07:50 AM
Hi, all
(newbie)
I've read the other postings regarding this error "The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content."
But still can't solve my problem. I DO have the buffer=true at the top as you'll see, but I still get the error. I've also tried putting response.clear just before my redirect. Here's some of the code. Any help would be greatly appreciated!
<%@ language="VBSCRIPT" %>
<% Response.Buffer = True %>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/adovbs.inc"-->
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/vbUtils.asp"-->
<%
dim sSQL,oRST, oCN
Set oCN = OpenConnection() ''Open a database connection
%>
<%
dim done
done = request.form("done")
if done = "" then
done = "No"
%>
<html>
<head>
<title>Tell a friend</title>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/header.asp"-->
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/left_sidebar.asp"-->
<td width="558" valign="top">
<h3>Refer a Friend!</h3>
Let your friend's know about our site! Your email addresses will not be shared with anyone.<br><br>
<body>
<table border="0" cellspacing="2" cellpadding="4" width=300>
<form action="default.asp" method="post">
<tr>
<td align=right>Your Name: </td>
<td><input type="text" name="sendername" size="25" maxlength="50"></td>
</tr>
<tr>
<td align=right>Your E-Mail: </td>
<td><input type="text" name="sendemail" size="25" maxlength="50"></td>
</tr>
<tr>
<td align=right>Friend's Name: </td>
<td><input type="text" name="friendname" size="25" maxlength="50"></td>
<tr>
<td align=right>Friend's E-Mail: </td>
<td><input type="text" name="friendemail" size="25" maxlength="50"><BR>
<input type="hidden" name="done" value="Yes"></td>
</tr>
<tr></tr>
<tr>
<td colspan=2><center><input type="submit" name="submit" value="Tell a friend!" ></center></td>
</tr>
</form>
</Table>
<%
Else
if request.form("done") = "Yes" then
'sets variables
dim sendmail, sendername, senderemail, friendname, friendemail
sendername = request.form("sendername")
senderemail = request.form("sendemail")
friendname = request.form("friendname")
friendemail = request.form("friendemail")
referdate = Date
Set sendmail = Server.CreateObject("CDONTS.NewMail")
'put the webmaster address here
sendmail.From = senderemail
'The mail is sent to the address entered in the previous page.
sendmail.To = friendemail
'Enter the subject of your mail here
sendmail.Subject = "Check out this website"
'send a specific page or send a site url
dim url
'url = Request.ServerVariables("HTTP_REFERER")
url = "http://bigal.itsm.macewan.ca/StudentWeb/PTetz/MCSP255/final/"
'This is the content of thr message.
sendmail.Body = "A great site recommendation from a friend!" & _
vbCrlf & vbCrlf & "Your friend " & sendername & " has sent you this email and thought you would should check out Artisan Metalworks." & _
vbCrlf & url & vbCrlf
'this sets mail priority.... 0=low 1=normal 2=high
sendmail.Importance = 1
sendmail.Send 'Send the email!
''if all went well, insert into database...
sSQL = "INSERT INTO tblAMReferAFriend "
sSQL = sSQL & "(refer_fname,refer_email,ref_friend_fname, ref_friend_email,refer_date)"
sSQL = sSQL & " VALUES ( "
sSQL = sSQL & "'" & sendername & "',"
sSQL = sSQL & "'" & senderemail & "',"
sSQL = sSQL & "'" & friendname & "',"
sSQL = sSQL & "'" & friendemail & "',"
sSQL = sSQL & "'" & referdate & "' "
sSQL = sSQL & ")"
dim oCmd
Set oCN = OpenConnection() ''Open a database connection
Set oCmd = ExecuteCommand(oCN,sSQL) ''Execute SQL
oCN.close()
Set oCmd=nothing
Set oCN=nothing
response.redirect "referthankyou.asp"
End if
End if
%>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/footer.asp"-->
(newbie)
I've read the other postings regarding this error "The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content."
But still can't solve my problem. I DO have the buffer=true at the top as you'll see, but I still get the error. I've also tried putting response.clear just before my redirect. Here's some of the code. Any help would be greatly appreciated!
<%@ language="VBSCRIPT" %>
<% Response.Buffer = True %>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/adovbs.inc"-->
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/vbUtils.asp"-->
<%
dim sSQL,oRST, oCN
Set oCN = OpenConnection() ''Open a database connection
%>
<%
dim done
done = request.form("done")
if done = "" then
done = "No"
%>
<html>
<head>
<title>Tell a friend</title>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/header.asp"-->
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/left_sidebar.asp"-->
<td width="558" valign="top">
<h3>Refer a Friend!</h3>
Let your friend's know about our site! Your email addresses will not be shared with anyone.<br><br>
<body>
<table border="0" cellspacing="2" cellpadding="4" width=300>
<form action="default.asp" method="post">
<tr>
<td align=right>Your Name: </td>
<td><input type="text" name="sendername" size="25" maxlength="50"></td>
</tr>
<tr>
<td align=right>Your E-Mail: </td>
<td><input type="text" name="sendemail" size="25" maxlength="50"></td>
</tr>
<tr>
<td align=right>Friend's Name: </td>
<td><input type="text" name="friendname" size="25" maxlength="50"></td>
<tr>
<td align=right>Friend's E-Mail: </td>
<td><input type="text" name="friendemail" size="25" maxlength="50"><BR>
<input type="hidden" name="done" value="Yes"></td>
</tr>
<tr></tr>
<tr>
<td colspan=2><center><input type="submit" name="submit" value="Tell a friend!" ></center></td>
</tr>
</form>
</Table>
<%
Else
if request.form("done") = "Yes" then
'sets variables
dim sendmail, sendername, senderemail, friendname, friendemail
sendername = request.form("sendername")
senderemail = request.form("sendemail")
friendname = request.form("friendname")
friendemail = request.form("friendemail")
referdate = Date
Set sendmail = Server.CreateObject("CDONTS.NewMail")
'put the webmaster address here
sendmail.From = senderemail
'The mail is sent to the address entered in the previous page.
sendmail.To = friendemail
'Enter the subject of your mail here
sendmail.Subject = "Check out this website"
'send a specific page or send a site url
dim url
'url = Request.ServerVariables("HTTP_REFERER")
url = "http://bigal.itsm.macewan.ca/StudentWeb/PTetz/MCSP255/final/"
'This is the content of thr message.
sendmail.Body = "A great site recommendation from a friend!" & _
vbCrlf & vbCrlf & "Your friend " & sendername & " has sent you this email and thought you would should check out Artisan Metalworks." & _
vbCrlf & url & vbCrlf
'this sets mail priority.... 0=low 1=normal 2=high
sendmail.Importance = 1
sendmail.Send 'Send the email!
''if all went well, insert into database...
sSQL = "INSERT INTO tblAMReferAFriend "
sSQL = sSQL & "(refer_fname,refer_email,ref_friend_fname, ref_friend_email,refer_date)"
sSQL = sSQL & " VALUES ( "
sSQL = sSQL & "'" & sendername & "',"
sSQL = sSQL & "'" & senderemail & "',"
sSQL = sSQL & "'" & friendname & "',"
sSQL = sSQL & "'" & friendemail & "',"
sSQL = sSQL & "'" & referdate & "' "
sSQL = sSQL & ")"
dim oCmd
Set oCN = OpenConnection() ''Open a database connection
Set oCmd = ExecuteCommand(oCN,sSQL) ''Execute SQL
oCN.close()
Set oCmd=nothing
Set oCN=nothing
response.redirect "referthankyou.asp"
End if
End if
%>
<!--#include virtual="/StudentWeb/PTetz/MCSP255/final/includes/footer.asp"-->