473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

redirect on the home page

I have the following code to redirect users to
http://www.mydomain.com/new/default.asp if they use the URL www.newstuff.com
(sample). I have that domain name parked on www.mydomain.com. I'm getting
the follwing error...

Response object error 'ASP 0156 : 80004005'
Header Error
/Default.asp, line 21 <--- this is my home page
The HTTP headers are already written to the client browser. Any HTTP header
modifications must be made before writing page content.

Can anyone give me a clue?
thanks!

<%
sname = UCASE(Request.ServerVariables("SERVER_NAME"))
If InStr(sname,"NEWSTUFF") <> 0 then
response.redirect "http://www.mydomain.com/new/"
End If
%>
Jul 19 '05 #1
3 3960
You cannot redirect if you have already sent data to the client, for
example:

<html>
<head>
<title>a page</title>
<% response.redirect "somewhereelse" %>

You have to either put your redirect prior to any html or any header
writing, or turn on buffering. I'll assume you're on NT4, since buffering
is off by default in IIS4. Or, you have buffering turned off. You can
enable buffering for your page by doing:

<%
response.buffer = true %>

That will hold all html in a buffer until the page is finished processing.

Ray at work

"shank" <sh***@tampabay.rr.com> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
I have the following code to redirect users to
http://www.mydomain.com/new/default.asp if they use the URL www.newstuff.com (sample). I have that domain name parked on www.mydomain.com. I'm getting
the follwing error...

Response object error 'ASP 0156 : 80004005'
Header Error
/Default.asp, line 21 <--- this is my home page
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

Can anyone give me a clue?
thanks!

<%
sname = UCASE(Request.ServerVariables("SERVER_NAME"))
If InStr(sname,"NEWSTUFF") <> 0 then
response.redirect "http://www.mydomain.com/new/"
End If
%>

Jul 19 '05 #2

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl...
You cannot redirect if you have already sent data to the client, for
example:

<html>
<head>
<title>a page</title>
<% response.redirect "somewhereelse" %>

You have to either put your redirect prior to any html or any header
writing, or turn on buffering. I'll assume you're on NT4, since buffering
is off by default in IIS4. Or, you have buffering turned off. You can
enable buffering for your page by doing:

<%
response.buffer = true %>

That will hold all html in a buffer until the page is finished processing.

Ray at work

"shank" <sh***@tampabay.rr.com> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
I have the following code to redirect users to
http://www.mydomain.com/new/default.asp if they use the URL

www.newstuff.com
(sample). I have that domain name parked on www.mydomain.com. I'm getting the follwing error...

Response object error 'ASP 0156 : 80004005'
Header Error
/Default.asp, line 21 <--- this is my home page
The HTTP headers are already written to the client browser. Any HTTP

header
modifications must be made before writing page content.

Can anyone give me a clue?
thanks!

<%
sname = UCASE(Request.ServerVariables("SERVER_NAME"))
If InStr(sname,"NEWSTUFF") <> 0 then
response.redirect "http://www.mydomain.com/new/"
End If
%>


This is my first 3 lines...
When I added the buffer statement, the home page (default.asp) would not
load at all.
Am I missing something?
thanks!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<%@LANGUAGE="VBSCRIPT"%>
<% response.buffer = true %>
Jul 19 '05 #3

"shank" <sh***@tampabay.rr.com> wrote in message
news:uJ**************@TK2MSFTNGP11.phx.gbl...
This is my first 3 lines...
When I added the buffer statement, the home page (default.asp) would not
load at all.
Am I missing something?
thanks!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
That first line looks like client response to me.
<%@LANGUAGE="VBSCRIPT"%>
<% response.buffer = true %>


You won't see anything if this is all your page is.

What are you trying to do? What I'm saying is if you choose to use
response.redirect, you cannot use it if you have already sent any response
to the client. So, you either have to turn on buffering at the top of your
page, or you have to redirect at the top of your page.

Ray at work
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
3
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
0
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun...
5
by: PaulThomas | last post by:
Working with XP-Pro and VS.Net I have set my Start Page to "Home.aspx" but the application always starts the "Login" page - - - How can I change the start page to the Home.aspx??? On the login...
1
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun...
1
by: steggun | last post by:
How can I always redirect any user to the "home" page? Basically, a user could enter a full URL in the address bar or bookmark a specific page so that they can go directly to that page. However,...
2
by: Sergej Prokoviev | last post by:
We are running our site at www.waynesavings.com on secure hosting (Server 2003, IIS). We are using a custom 403.4 error page (called 403_4.asp, located under root) to redirect all users to https if...
0
by: omer013 | last post by:
Hi; I have an aspx page with a WebMethod to redirect the user to another page. The Default.aspx.cs is; public partial class _Default : System.Web.UI.Page { public static void...
18
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.