Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Can somebody explain this?


Message #1 by TL Jackson <actionjackson@a...> on Mon, 24 Dec 2001 04:35:38 -0500
I was wondering if somebody can help me here.  I'm getting the following 

error message and I was wondering if somebody can help me understand 

it.  The error code is:



---------------------------------------------------------------------------------



Response object error 'ASP 0156 : 80004005'

Header Error

/auto/checklogin.asp, line 30

The HTTP headers are already written to the client browser. Any HTTP header 

modifications must be made before writing page content.



---------------------------------------------------------------------------------



Here is the code that I'm using: (Line 30 is marked)



----------------------------------------------------------------------------------





         Dim strUser, strPassword

         strUser = Request("User")

         strPassword = Request("Password")



         Dim rsUsers



         set rsUsers = Server.CreateObject("ADODB.Recordset")

         strSQL = "SELECT * FROM security where sec_username = '" & strUser 

& "';"

         rsUsers.Open strSQL, objConn



         If rsUsers.EOF 

Then 

' User Not Found

                 Session("Username") = Request("user")

                 If Request("SecondTry") = "True" 

then                           ' User's had two goes

                         Response.Write "You must work for the Automation 

Department to enter this area"

                 Else

                         Response.Redirect 

"auto/autologin.asp?SecondTry=True"   ' allow another go

                 End if

         Else 

' one or more user found - check password

                 While Not rsUsers.EOF

                         If UCase(rsUsers("sec_password")) = 

UCase(strPassword) Then

                                 Dim strName, strValue

                                 For Each strField in rsUsers.Fields

                                         strName = strField.Name

                                         strValue = strField.Value

                                         Session(strName) = strValue

                                 Next

                                         Session("blnValidUser") = True

                                         Response.Redirect 

"auto/admin/panel.asp"        <-------------- Line 30

                         Else

                                 rsUsers.MoveNext

                         End If

                 Wend

                 Session("Username") = Request("user")

                 If Request("SecondTry") = "True" then

                         Response.Write "You must work for the Automation 

Department to enter this area"

                 Else

                         Response.Redirect 

"auto/autologin.asp?SecondTry=True&WrongPW=True"

                 End If

         End If

         objRS.Close

         Set objRS = Nothing

         objConn.Close

         Set objConn = Nothing



--------------------------------------------------------------------------------------



Thank you!



T.L.







Message #2 by Aftab Ahmad <aftab.ahmad@k...> on Mon, 24 Dec 2001 10:53:24 +0100
Try with this:



1- Write 	Response.Buffer=true	at the top of the page.

2- Before redirecting to new page (before using Response.Redirect) write

Response.Clear



Hope it will help.



Aftab



-----Original Message-----

From: TL Jackson [mailto:actionjackson@a...]

Sent: 24. desember 2001 10:36

To: ASP Databases

Subject: [asp_databases] Can somebody explain this?





I was wondering if somebody can help me here.  I'm getting the following 

error message and I was wondering if somebody can help me understand 

it.  The error code is:



----------------------------------------------------------------------------

-----



Response object error 'ASP 0156 : 80004005'

Header Error

/auto/checklogin.asp, line 30

The HTTP headers are already written to the client browser. Any HTTP header 

modifications must be made before writing page content.



----------------------------------------------------------------------------

-----



Here is the code that I'm using: (Line 30 is marked)



----------------------------------------------------------------------------

------





         Dim strUser, strPassword

         strUser = Request("User")

         strPassword = Request("Password")



         Dim rsUsers



         set rsUsers = Server.CreateObject("ADODB.Recordset")

         strSQL = "SELECT * FROM security where sec_username = '" & strUser 

& "';"

         rsUsers.Open strSQL, objConn



         If rsUsers.EOF 

Then 

' User Not Found

                 Session("Username") = Request("user")

                 If Request("SecondTry") = "True" 

then                           ' User's had two goes

                         Response.Write "You must work for the Automation 

Department to enter this area"

                 Else

                         Response.Redirect 

"auto/autologin.asp?SecondTry=True"   ' allow another go

                 End if

         Else 

' one or more user found - check password

                 While Not rsUsers.EOF

                         If UCase(rsUsers("sec_password")) = 

UCase(strPassword) Then

                                 Dim strName, strValue

                                 For Each strField in rsUsers.Fields

                                         strName = strField.Name

                                         strValue = strField.Value

                                         Session(strName) = strValue

                                 Next

                                         Session("blnValidUser") = True

                                         Response.Redirect 

"auto/admin/panel.asp"        <-------------- Line 30

                         Else

                                 rsUsers.MoveNext

                         End If

                 Wend

                 Session("Username") = Request("user")

                 If Request("SecondTry") = "True" then

                         Response.Write "You must work for the Automation 

Department to enter this area"

                 Else

                         Response.Redirect 

"auto/autologin.asp?SecondTry=True&WrongPW=True"

                 End If

         End If

         objRS.Close

         Set objRS = Nothing

         objConn.Close

         Set objConn = Nothing



----------------------------------------------------------------------------

----------



Thank you!



T.L.












$subst('Email.Unsub').

Message #3 by TL Jackson <actionjackson@a...> on Mon, 24 Dec 2001 12:47:42 -0500
Aftab,



         Thanks for your help.  I did try it with no prevail.  What I don't 

understand is that I'm using this same file on another website and it works 

perfectly.  I been using this code for over a year now with no 

problems.  Thanks for trying.  Any other ideas?



T.L.







At 10:53 AM 12/24/2001 +0100, you wrote:

>Try with this:

>

>1- Write        Response.Buffer=true    at the top of the page.

>2- Before redirecting to new page (before using Response.Redirect) write

>Response.Clear

>

>Hope it will help.

>

>Aftab



Message #4 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 25 Dec 2001 00:49:58 +0100
on iis4, "response.buffer = false" is the default.  on iis5,

"response.buffer = true" is the default.



-Kim



> -----Original Message-----

> From: TL Jackson [mailto:actionjackson@a...]

> Sent: 24. december 2001 18:48

> To: ASP Databases

> Subject: [asp_databases] RE: Can somebody explain this?

>



>

>          Thanks for your help.  I did try it with no prevail.

> What I don't

> understand is that I'm using this same file on another website

> and it works

> perfectly.  I been using this code for over a year now with no

> problems.  Thanks for trying.  Any other ideas?

>

> T.L.

>

>

>

> At 10:53 AM 12/24/2001 +0100, you wrote:

> >Try with this:

> >

> >1- Write        Response.Buffer=true    at the top of the page.

> >2- Before redirecting to new page (before using Response.Redirect) write

> >Response.Clear

> >

> >Hope it will help.

> >

> >Aftab




  Return to Index