Forums
This topic is locked
Redirect on user
Posted 23 Feb 2002 18:39:30
1
has voted
23 Feb 2002 18:39:30 Mary Aguilar posted:
Ok, I created a login section but would like to redirect depending on the username entered. I have an access database with a username and url column. If the user1 enters his info, then he will be directed to the user1 site. If user2 enters his info, he will be directed to the user2 site, etc. Any help will be greatly appreciated. I understand initially I can redirect to an in between page which would hold the if statement and then redirect. Thanks!Replies
Replied 24 Feb 2002 05:13:55
24 Feb 2002 05:13:55 Owen Eastwick replied:
When the user logs in the next page is your redirect page, which is just ASP code, no HTML so it runs entirely at the server, with a recordset with a source something like:
RecodsetName.Source = "SELECT RedirectURL FROM UserTable WHERE UserName LIKE '" & Session("MM_Username" & "'"
Then after all the recordset code:
<% Response.Redirect(RecordsetName.Fields.Item("RedirectPage".Value) %>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
RecodsetName.Source = "SELECT RedirectURL FROM UserTable WHERE UserName LIKE '" & Session("MM_Username" & "'"
Then after all the recordset code:
<% Response.Redirect(RecordsetName.Fields.Item("RedirectPage".Value) %>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 24 Feb 2002 20:49:06
24 Feb 2002 20:49:06 Mary Aguilar replied:
Owen, thanks very much for helping me out. This is the code on the redirect page:
<%
set rClients = Server.CreateObject("ADODB.Recordset"
rClients.ActiveConnection = MM_hexClients_STRING
rClients.Source = "SELECT URL FROM clientList"
rClients.CursorType = 0
rClients.CursorLocation = 2
rClients.LockType = 3
rClients.Open()
rClients_numRows = 0
%>
<%
rClients.Close()
%>
<% Response.Redirect(rClients.Fields.Item("RedirectPage".Value) %>
This is the error I get:
ADODB.Field error '800a0e78'
Operation is not allowed when the object is closed.
/clients/redirect.asp, line 17
I'm not sure what the problem is.
<%
set rClients = Server.CreateObject("ADODB.Recordset"
rClients.ActiveConnection = MM_hexClients_STRING
rClients.Source = "SELECT URL FROM clientList"
rClients.CursorType = 0
rClients.CursorLocation = 2
rClients.LockType = 3
rClients.Open()
rClients_numRows = 0
%>
<%
rClients.Close()
%>
<% Response.Redirect(rClients.Fields.Item("RedirectPage".Value) %>
This is the error I get:
ADODB.Field error '800a0e78'
Operation is not allowed when the object is closed.
/clients/redirect.asp, line 17
I'm not sure what the problem is.
Replied 24 Feb 2002 22:52:16
24 Feb 2002 22:52:16 Owen Eastwick replied:
Move the redirect line above the recordset close:
<%
set rClients = Server.CreateObject("ADODB.Recordset"
rClients.ActiveConnection = MM_hexClients_STRING
rClients.Source = "SELECT URL FROM clientList"
rClients.CursorType = 0
rClients.CursorLocation = 2
rClients.LockType = 3
rClients.Open()
rClients_numRows = 0
%>
<% Response.Redirect(rClients.Fields.Item("RedirectPage".Value) %>
<%
rClients.Close()
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<%
set rClients = Server.CreateObject("ADODB.Recordset"
rClients.ActiveConnection = MM_hexClients_STRING
rClients.Source = "SELECT URL FROM clientList"
rClients.CursorType = 0
rClients.CursorLocation = 2
rClients.LockType = 3
rClients.Open()
rClients_numRows = 0
%>
<% Response.Redirect(rClients.Fields.Item("RedirectPage".Value) %>
<%
rClients.Close()
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo