Header Error - Need Help

Results 1 to 2 of 2

Thread: Header Error - Need Help

  1. #1
    Join Date
    Dec 1969

    Default Header Error - Need Help

    HI,<BR>I have a simple login program but can&#039t seem to redirect to the appropriate page. I get a Header Error Message which says:<BR>"The HTTP Headers are already written to the client browser. Any HTTP header modifications must be made before writing page content".<BR>What does this mean? I haven&#039t event accessed the Admin.asp page yet. Here is my code:<BR>&#060;!-- #include file="adovbs.inc" --&#062;<BR><BR>&#060;% <BR>Dim oRS<BR>Dim boolEOF<BR>Dim strSQL<BR>Dim strLoginID<BR>Dim strPassword<BR> <BR>strLoginID = Request.Form("txtLoginID")<BR>strPassword = Request.Form("txtPassword")<BR>response.write ("strloginid is now = &#039 " & strloginid & " &#039 ")<BR>response.write ("strpassword is now = &#039 " & strpassword & " &#039 ")<BR><BR>&#039*********************************** *****<BR>&#039 Look up user in tblUsers Table <BR>&#039****************************************< BR>strSQL = "SELECT * FROM tblUsers "<BR>strSQL = strSQL & "WHERE sLogin_id = &#039" & strLoginID & "&#039"<BR>&#039strSQL = strSQL & " AND sPassword_tx = &#039" & strPassword & "&#039"<BR><BR>Set ors = Server.createobject("ADODB.Recordset")<BR>ors.open strsql, "artscouncil",adopendynamic, adlockoptimistic<BR><BR>boolEOF = oRS.EOF<BR><BR>oRS.Close<BR>Set oRS = Nothing<BR><BR>If boolEOF Then<BR> Response.Redirect("LoginError.asp")<BR> <BR>Else<BR> Response.Redirect("http://localhost/arts/admin.asp")<BR> <BR>End If<BR>%&#062;<BR><BR>Sure could use some advice here. Thanks in advance for your response.

  2. #2
    Join Date
    Dec 1969

    Default RE: Header Error - Need Help

    Response.Redirect will fail with that message if anything has been written to the client already (for example, the opening &#060;HTML&#062; tag). The solution is to specify Response.Buffer = True at the top of the page; this keeps all the information at the server until either<BR><BR>1. Response.Flush<BR>2. Response.End<BR>3. The end of your code is reached and the server is done with it.<BR><BR>This way, you can redirect to another page in the middle of your code, but nothing has been written to the browser yet.<BR><BR>Good luck!<BR><BR>Mike<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts