Where do I set it?
Main Topics
Browse All TopicsI'm currently registering users according to the below criteria:
If rsUser.recordCount > 0 Then
Response.Cookies("adminID"
Response.Cookies("adminNam
Response.Redirect "../main.asp"
Else
Response.Redirect "../loginFailure.asp"
End If
I need to put another condition like this:
If user AccessLevel = '0' then response.redirect main1.asp
If user AccessLevel = '1' then response.redirect main2.asp
I tried to incorporate the code inside main.asp, like below, but it doesn't work (it gives a blank page)
<% if session("AccessLevel")="1"
response.redirect = "main1.asp"
elseif session("AccessLevel")="0"
response.redirect = "main2.asp"
end if %>
What am I doing wrong?
The code can also be incorporated inside main.asp. I tried but that also gives a blank page.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
<%
If Session("AccessLevel")="1"
Response.Redirect("main1.a
ElseIf Session("AccessLevel")="0"
Response.Redirect("main2.a
Else
Response.Write("this isn't a blank page")
End If
%>
All Zamorin meant about setting it is that it isn't assigned a value in the script you posted...
So above the condition you write
Session("AccessLevel") = 1 ' or get this from the database
Response.Redirect is a method not a property, therefore = should not be included
Ciao.
yes.. you have to set it to the database value... see below where rsUser("adminLevel") is your column name in the database (ensure it's coming back in your SQL statement as well)
If rsUser.recordCount > 0 Then
Response.Cookies("adminID"
Response.Cookies("adminNam
Session("AccessLevel") = rsUser("adminLevel")
If Session("AccessLevel") = "1" Then
Response.Redirect("main1.a
ElseIf Session("AccessLevel") = "0" Then
Response.Redirect("main2.a
Else
Response.Write("no admin level was found")
Response.End
End If
Else
Response.Redirect("../logi
End If
Thanks for the points and comment. For your info, this script is a little more refined and may be useful if you add more access levels later:
Dim pagePath
' Login Failure Page
pagePath = "../loginFailure.asp"
If rsUser.recordCount > 0 Then
Response.Cookies("adminID"
Response.Cookies("adminNam
Session("AccessLevel") = rsUser("adminLevel")
Select Case Trim(Session("AccessLevel"
Case "0"
' Standard Membership
pagePath = "../main2.asp"
Case "1"
' Premium Membership
pagePath = "../main1.asp"
End Select
End If
Response.Redirect(pagePath
Business Accounts
Answer for Membership
by: tirandaganPosted on 2004-11-17 at 19:09:51ID: 12611021
It looks like you forgot to set the session variable ("AccessLevel").
I assume your login validation should contain something like:
session("AccessLevel") = rsUser("AccessLevel")
Because from the example you provided, session("accessLevel") is not being set, so is = NULL, so both conditions fail and what you are left with is the rest of the main.asp file, which is nothing (ego, blank page)