[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

How do I redirect users to different pages while login? Need help

Asked by AmitavaCh in Active Server Pages (ASP), Microsoft Access Database

Tags: Active Server Pages / MS Access

Hi!
I would like to create a login page, where multiple people can logon to the system and based on the 'usergroup' defined, they will be redirected to the respective users' group.
I am using .asp & MS access at the database (to store user information). Thought I am able to redirect users to next page, I am unable to redirect users to their respective groups. I am using the following files:

DSNLessPWCheck.asp
LoginPage.asp
LoginPagePass.asp

and four different pages, where users would be redirected as per their group, such as Group 1 should be redirected to Page1.asp...and so on

Page1.asp
Page2.asp      
Page3.asp
Page4.asp

Can you just check and let me know where I am doing wrong and how to correct this to get the desired result. The codes are attached sequence-wise:
1. *** File No.1 LoginPage.asp ***
2. *** File No.2 LoginPagePass.asp ***
3. *** File No.1 Page1.asp ***

I have attached my other file (i.e. DSNLessPWCheck.asp) in .txt format, along with LoginDatabase.mdb (ID, UserName, Password & UserGroup), LoginPageFail.txt and UserGroupFail.txt
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
*** File No.1 LoginPage.asp ***
<%@LANGUAGE="JavaScript"%>
<%
var dbFilePath = "DBQ=" + Server.MapPath("LoginDatabase.mdb");
var connectionStr = "Driver={Microsoft Access Driver (*.mdb)}";
var dbConnection = Server.CreateObject("ADODB.Connection");
dbConnection.open(connectionStr + ";" + dbFilePath);
var LoginInfoRst = dbConnection.execute("SELECT * FROM LoginInfo");
%>
<html>
<head>
<title>Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<div id="Layer1" style="position:absolute; left:59px; top:68px; width:357px; height:42px; z-index:1"> 
  <div align="center"><font face="Arial, Helvetica, sans-serif"><b>Welcome to 
    our login page, Please enter your Username &amp; Password.</b></font></div>
</div>
<div id="Layer3" style="position:absolute; width:514px; height:141px; z-index:3; left: 3px; top: 274px">
  <table width="100%" border="0" cellspacing="1" cellpadding="1" height="21">
    <tr>
      <td width="28%"><A><b>UserName</b></A></td>
      <td width="37%"><b>Password</b></td>
      <td width="35%"><b>UserGroup</b></td>
    </tr>
<% while(!LoginInfoRst.EOF){%>
	<tr>
	  <td width="28"><A><%=LoginInfoRst("UserName")%></A></td>
	  <td width="37"><A><%=LoginInfoRst("Password")%></A></td>
      <td width="35"><A><%=LoginInfoRst("UserGroup")%></A></td>
    </tr>
<% LoginInfoRst.MoveNext();}%> 
  </table>
</div>
<div id="Layer2" style="position:absolute; left:169px; top:115px; width:137px; height:143px; z-index:2"> 
  <form name="form1" method="post" action="DSNLessPWCheck.asp">
    <p> 
      <input type="text" name="edtUsername">
      <br>
      <input type="password" name="edtPassword">
      <br>
	  <input type="submit" name="btnLogin" value="Login">
    </p>
    </form>
</div>
</body>
<%
	LoginInfoRst.close();
	dbConnection.close();
	dbConnection = null;
%>
</html>
*** File No.2: LoginPagePass.asp ***
<%@LANGUAGE="JAVASCRIPT"%>
<%
var sessionGroup = "1";
var loopLength = 0;
var valid = false;
 
//This routine checks the Session Variable for SessionPassword, if it matches keep the
//client on this page, if not, then redirect them to the UserGroupFail.html
sessionGroup = sessionGroup.split(",");
while (sessionGroup.length > loopLength && valid == false) 
{
  SessionValue = sessionGroup[loopLength] 
  if (Session("SessionPassword")) 
  {
      if (Session("SessionPassword") == SessionValue)
      {
      valid = true;
      }
  }
  loopLength++;
}
 
if (valid == false)  
{
  Response.Redirect(escape("Page1.asp"))
}
var mySession = Session("SessionPassword");
var mySession1 = Session("ID");
%>
 
 
<html>
<head>
<title>Login Page Pass</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body bgcolor="#FFFFFF">
 
<div id="Layer1" style="position: absolute; left: 58; top: 69; width: 370; height: 196; z-index: 1"><font face="Arial, Helvetica, sans-serif">Congratulation! 
  Thank you for validating your user ID & password - enjoy your stay...</font><BR>
</div>
</body>
</html>
 *** File No.3: Page1.asp ***
<%@LANGUAGE="JAVASCRIPT"%>
<%
var sessionGroup = "0";
var loopLength = 0;
var valid = false;
//This routine checks the Session Variable for SessionPassword, if it matches keep the
//client on this page, if not, then redirect them to the UserGroupFail.html
sessionGroup = sessionGroup.split(",");
while (sessionGroup.length > loopLength && valid == false) 
{
  SessionValue = sessionGroup[loopLength] 
  if (Session("SessionPassword")) 
  {
      if (Session("SessionPassword") == SessionValue)
      {
      valid = true;
      }
  }
  loopLength++;
}
if (valid == false)  
{
  Response.Redirect(escape("UserGroupFail.html"))
}
var mySession = Session("SessionPassword");
var mySession1 = Session("ID");
%>
<html>
<head>
<title>Login Page Pass</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<div id="Layer1" style="position: absolute; left: 58; top: 69; width: 370; height: 196; z-index: 1"><font face="Arial, Helvetica, sans-serif">Congratulation! 
  Thank you for validating your user ID & password - enjoy your stay...</font><BR>
</div>
</body>
</html>
Attachments:
 
All the files attached
 
[+][-]08/13/09 02:31 AM, ID: 25086544Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/13/09 05:14 AM, ID: 25087291Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/13/09 07:47 AM, ID: 25088903Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Active Server Pages (ASP), Microsoft Access Database
Tags: Active Server Pages / MS Access
Sign Up Now!
Solution Provided By: cedlinx
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625