Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with my logon page

Status
Not open for further replies.

MikeL91

Programmer
Feb 8, 2001
100
US
I tring to learn this from a book, but
I keep getting this error:

Response object error 'ASP 0156 : 80004005'
Header Error
/logon.asp, line 26

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

Here is my code from Logon.asp:
-----------------------------------------------------
<% @ Language = &quot;VBSCRIPT&quot;%>

<!-- Establish Variable -->
<% Dim oCONv, oRSu %>

<!-- Create Server Object -->
<% Set oCONv = Server.CreateObject(&quot;ADODB.Connection&quot;) %>

<!-- Open Server Object -->
<% oCONv.Open &quot;Driver={Microsoft Access Driver (*.mdb)};&quot; & _
&quot;DBQ=C:\AFPtest\Vault.MDB&quot; %>

<%
If Session(&quot;UserID&quot;) = &quot;&quot; or Request.Form(&quot;UserID&quot;) <> &quot;&quot; then
Session(&quot;UserID&quot;) = &quot;&quot;

Set oRSu = oCONv.Execute(&quot;SELECT tblUsers.UserID, tblUsers.Password FROM tblUsers &quot; &_
&quot;WHERE UserID = '&quot; & Request.Form(&quot;UserID&quot;) &_
&quot;' AND Password = '&quot; & Request.Form(&quot;Password&quot;) &_
&quot;' AND Date()-32<tblUsers.DAteSold&quot;)

if not oRSu.EOF then
Session(&quot;UserID&quot;) = oRSu(&quot;UserID&quot;)
Response.Redirect&quot;ok.htm&quot;
else
Response.Redirect &quot;sorry.htm&quot;
end if
end if
%>
-------------------------------------------------
I thank you in advance
-Mike
 
Whenever you use a Response.Redirect, it is best to declare
Code:
<%Response.Buffer=True%>
at the top of your page, right under the Language=VBScript declaration.
The reason for this is that the server can't redirect to a new page if parts of the existing page have already been sent to the client. (That's what the http header message is all about.) The Response.Buffer allows you to get around this. As far as I understand (please correct me if I am wrong), this forces the server to wait until all processing is complete before sending the page to the client.

I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top