Link to home
Start Free TrialLog in
Avatar of rogueripper
rogueripper

asked on

Response.Redirect Problem

Hi there

I am running the following from a Windows NT 4.0 workstation on IE 6.0

This is my options.asp page's content:


<%@ Language=VBScript %>
<!--#include file="iiSecurity.asp"-->
<!-- #include file = "common/d5wfl1a.asp" -->

<%

dim Redirector

     if Session("FullScreen") = True Then
          Redirector = "fullscreen.asp"
          Session("windowstate") = "Show Tree"
     else
          Redirector = "main.asp"
          Session("windowstate") = "Full Screen"
     end if

     Response.Redirect Redirector

%>



This is the error I receive when I run it in IE



Response object error 'ASP 0156 : 80004005'

Header Error

/fedpacs/options.asp, line 17

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content




How do I solve this?

Thanx! :o)


Avatar of AlfaNoMore
AlfaNoMore

First line of code (before those include files) needs to be a quick Response.Buffer = True. Put this at the very top of your page, and you'll be OK!!
ASKER CERTIFIED SOLUTION
Avatar of etmendz
etmendz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
roqueripper,

Use Response.Buffer = 0 in the top page, exp:

<%@ Language=VBScript %>
<%Response.Buffer = 0%>
<!--#include file="iiSecurity.asp"-->
<!-- #include file = "common/d5wfl1a.asp" -->

<%

dim Redirector

    if Session("FullScreen") = True Then
         Redirector = "fullscreen.asp"
         Session("windowstate") = "Show Tree"
    else
         Redirector = "main.asp"
         Session("windowstate") = "Full Screen"
    end if

    Response.Redirect Redirector

%>

Regards,
Wee Siong
Try replacing :

Response.Redirect Redirector

With:

Response.Clear
Response.Write "<script>parent.location='./../../" & Redirector & "'</script>")
<!--#include file="iiSecurity.asp"-->
<!-- #include file = "common/d5wfl1a.asp" -->

What are these? If they have ANY HTML code, or any response.write, that's what the problem is. You CANNOT have any output to the page, or generate any HTML output before the redirect.

And I'm betting that those are standard headers -- and HTML. If so, take them out.

Also, this
Response.Redirect Redirector
is referring to your FUNCTION -- that's not what you want. Redirect should take you to another PAGE, a completely different location. NOT run a function on the existing page. Doesn't work that way.
i have seen lots of people have somehting in teh security.asp file that outputs a comment "<-- Authenticated -->" and that will fail.