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!

Log In - Response.Redirect...

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US

Hello all...
1. I have a login page
if I type JrClown and in my Access DB I have JrClown with department 1, I want to be directed to page1.asp
if I sign in as John Smith with department 2, I want to be redirected to page2.asp

I need the syntax please, Thank you QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
I did that one time, and what I did was store the address of the page they were to be redirected to in the database --
Code:
rs.filter = &quot;name=link9&quot;

if not rs.eof then
  response.redirect(cstr(rs(&quot;address&quot;)))
else
  response.redirect(&quot;loginError.htm&quot;)
end if
Where there are two fields in the table, address, and name --

If you can't store the address in the database, then you could store the addresses in an array --
Code:
dim addressArray(2)
addressArray(1) = &quot;pageOne.asp&quot;
addressArray(2) = &quot;pageTwo.asp&quot;

rs.filter = &quot;name=link9&quot;

if not rs.eof then
  dim access
  access = rs(&quot;level&quot;)
else
  response.redirect(&quot;loginError.htm&quot;)
end if

response.redirect(cstr(addressArray(access)))
Where the two fields in the database are name & level -- level being the level of access -- or place you want to redirect them as long as the number matches to the location in the array --

hope it helps! :)
Paul Prewett
 
Hi Jr Clown,

you can do something like this,
-------------------------------------------------
Path = &quot;page&quot; + rst(&quot;department&quot;) + &quot;.asp&quot;
Response.Redirect(Path)
-------------------------------------------------
where rst(&quot;department&quot;), you get it from Access DB

hope this helps,
Chiu Chan
cchan@emagine-solutions.com
 
Thanks for you response guys, actually what I have is this and tell me if your suggestion can still be used on my DB

I have to fields
1. Name field = JrClown
2. Department field = 1

Then within the same table I have the same fields as follows:
Name field = John Smith
Department field = 2


if I log in as JrClown I want to be directed to page 1 and so on... just based on my department code.
QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Hi Jr Clown,

yes you can still use this
-------------------------------------------
Path = &quot;page&quot; + rst(&quot;department&quot;) + &quot;.asp&quot;
Response.Redirect(Path)
-------------------------------------------
the path should return as &quot;page1.asp&quot; if user from department 1 and &quot;pageX.asp&quot; for department &quot;X&quot;, where X is the department number.

However, i just notice that you may need to convert that integer number into string, to do that simply use &quot;CStr&quot; to do the convertion , for example:
-------------------------------------------
Path = &quot;page&quot; + CStr(rst(&quot;department&quot;)) + &quot;.asp&quot;
Response.Redirect(Path)
-------------------------------------------

Hope this helps,
Chiu Chan
cchan@emagine-solutions.com
 
Thanks again, I will try it and let you know. QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
it's not working fellas
QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
<%
Dim RSlogin
set RSlogin=server.createobject(&quot;adodb.recordset&quot;)
RSlogin.open &quot;login&quot;, &quot;dsn=names&quot;

Path = &quot;newjob&quot; + CStr(rst(&quot;department&quot;)) + &quot;.asp&quot;
Response.Redirect(Path)
%>

Would you mind explaing how your suggestion work bro, I must not understand it










QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Hi JrClown,

you should correct it to the following..
Path = &quot;newjob&quot; + CStr(RSlogin(&quot;department&quot;)) + &quot;.asp&quot;

also make sure the &quot;department&quot; is the right name you use in your AccessDB.

hope this helps,
good luck~
Chiu Chan
cchan@emagine-solutions.com
 
you should Response.Write(Path) and Response.End to see what it is outputting...that way you know which files it's looking for.

Hui
 
Dude,

I think you need to replace the &quot;+&quot;'s with &quot;&&quot;'s if you're using VBScript!:

Path = &quot;newjob&quot; & CStr(rst(&quot;department&quot;)) & &quot;.asp&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top