Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect does not work 1

Status
Not open for further replies.

uconn1981

Programmer
Mar 21, 2005
42
US
I have a HTML page for user to input email address. Then it will go to an ASP page to connect to a database. After that, I want to go back to the HTML page. No error for database part. However, my following code does not redirect the page back to the HTML page.

Thanks for any help.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<%
'AddToNewsLetter = Request.Form("yes_news")

'If AddToNewsLetter <> "" Then

ConnString = "DRIVER={Microsoft Access Driver (*.mdb)};"
ConnString = ConnString & "DBQ=" & Server.Mappath("NewsLetter.mdb")

Set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open ConnString

sql="INSERT INTO NewsLetterAdd (Email)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("news_email") & "')"

on error resume next
adoConn.Execute sql

if err<>0 then
response.write("Something wrong")
else
response.write("Everything is good")
Response.Redirect "ipoll_features.html"

end if

'End If

%>

</body>
</html>
 
try this: add this line...

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%Response.Buffer = true%>



or
...

if err<>0 then
response.write("Something wrong")
else
response.write("Everything is good")
%>
<script>
parent.targetframename.location.replace('ipoll_features.html');
</script>
<%
..

-DNG
 
Thanks, DNG.

Your first option works perfect.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top