chris_angell
04-07-2003, 06:59 PM
hello I have a page I want to redirect if the user has a password etc.. When i run the code it works fine if I put response.write in replace of response.redirect.. but why does it not work when I put response.redirect, I am daffled... :confused:
have i used if statments in the wrong place ?? hmm
here is my code,,
<% @LANGUAGE = VBScript %>
<!-- #INCLUDE FILE="dbconnection.asp" -->
<%
Dim Username
Username=request.form("Username")
strSQL = "SELECT * FROM tblClients WHERE tblClients.Username = '" & Username & "'"
rst1.open strSQL, strConnect, ado_Openkeyset, ado_LockOptimistic
if not(rst1.eof) then
rst1("Hits") = rst1("Hits") + 1
rst1.update
rst1.requery
else
end if
strSQL = "SELECT * FROM tblClients WHERE tblClients.UserName = '" & Username & "' AND tblClients.Password = '" & Password & "' AND tblClients.CompanyName = '" & Companyname & "'"
if not rst1.eof then%>
<%if rst1("SalesOrTech")=false then
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "sales/sales.asp?u=" & username & "&p=" & password & "&id=" & id
else
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "technical/tech.asp?u=" & username & "&p=" & password & "&id=" & id
end if
else
Response.write "pages/no_login_f.htm"
end if
%>
they need to be
Response.Redirect
oh and because I was new to the asp world.. I tried to get my code to do two functions... add a hit to a field and redirect the page to an according page ????
have i used if statments in the wrong place ?? hmm
here is my code,,
<% @LANGUAGE = VBScript %>
<!-- #INCLUDE FILE="dbconnection.asp" -->
<%
Dim Username
Username=request.form("Username")
strSQL = "SELECT * FROM tblClients WHERE tblClients.Username = '" & Username & "'"
rst1.open strSQL, strConnect, ado_Openkeyset, ado_LockOptimistic
if not(rst1.eof) then
rst1("Hits") = rst1("Hits") + 1
rst1.update
rst1.requery
else
end if
strSQL = "SELECT * FROM tblClients WHERE tblClients.UserName = '" & Username & "' AND tblClients.Password = '" & Password & "' AND tblClients.CompanyName = '" & Companyname & "'"
if not rst1.eof then%>
<%if rst1("SalesOrTech")=false then
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "sales/sales.asp?u=" & username & "&p=" & password & "&id=" & id
else
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "technical/tech.asp?u=" & username & "&p=" & password & "&id=" & id
end if
else
Response.write "pages/no_login_f.htm"
end if
%>
they need to be
Response.Redirect
oh and because I was new to the asp world.. I tried to get my code to do two functions... add a hit to a field and redirect the page to an according page ????