Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: runtime errors on redirect


Message #1 by "Moshe Golden" <golden@b...> on Tue, 20 Mar 2001 12:18:20
Following is a snippit of code.

I am attempting to redirect the browser to a different page which is determined by the input of certain data.



Either method produces an error.

Running on a Windows 98 machine under PWS

.

.

if conn.eof then 

response.redirect "invalidEntry.html" ' Error (1)

else

location.href = "validEntry.html"       'Error (2)

end if



1 Response object error 'ASP 0156 : 80004005

Header Error

.....,line 24

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



2. Microsoft VBScript runtime error '800a01a8'

Object required: 'location'

......, line 26



Any assistance in solving the problem would be appriciated.



Moshe Golden

Message #2 by samimer@h... on Fri, 23 Mar 2001 08:45:58
Your code has a couple of problems.



If your are redirecting then the first line of the script should be 

Response.Buffer=true.

By first line I mean before any thing is sent to the browser, even before 

the <HTML> tag is written on the browser. There is a very good explanation 

in Professional Active Server Pages 2.00 by Wrox Publication (and no I  am 

not getting paid to say this!)



2)Isn't location a javascript object? You are mixing your server side 

vbscript code and javascript. (That is your location object not found 

error)



3)Is conn a recordset or connection object? Most of the time you use conn 

or varaition of it for connection object.If it is connection object, then 

the check for eof will generate the error too. You will check the end of 

file on the recordset object.



> Following is a snippit of code.

> I am attempting to redirect the browser to a different page which is 

determined by the input of certain data.

> 

> Either method produces an error.

> Running on a Windows 98 machine under PWS

> .

> .

> if conn.eof then 

> response.redirect "invalidEntry.html" ' Error (1)

> else

> location.href = "validEntry.html"       'Error (2)

> end if

> 

> 1 Response object error 'ASP 0156 : 80004005

> Header Error

> .....,line 24

> The HTTP headers are laready written to the client browser. Any HTTP 

header modifications must be made before writing page content

> 

> 2. Microsoft VBScript runtime error '800a01a8'

> Object required: 'location'

> ......, line 26

> 

> Any assistance in solving the problem would be appriciated.

> 

> Moshe Golden


  Return to Index