Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 12th, 2004, 11:10 PM
djodyssey1127 djodyssey1127 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 6 djodyssey1127 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question restrict access to a page

Hi, im trying to restrict access to a page, i added a connection string, database, recordset, and a login form, all of that works, but once i log in and try to access the page that has the following code:

<%
If Session("userLevel") < 1 Then
Response.Redirect "error.asp"
End If
%>

(i add this code on top of a page to restrict access)
it still sends me to the error page, i think the Session information is not being sent to this page, how can i make this work?
id appreciate some help

-Alex

Reply With Quote
  #2  
Old June 14th, 2004, 09:05 AM
tfoulkes tfoulkes is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 9 tfoulkes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Have you tested the session variable to see if it has a value in it?
take the redirect out and try printing it out ::
<%
dim test
test = session("userlevel")
Response.Write("session :: "&test)
%>
If the value IS getting written in the session then your problem may be with that you're asking if the user level is less than 1... less than 1 is 0.

0 is a fickle value, and you may well be writing the value of the session equal to null, not the numerical value of 0.

eg:
session("userlevel") = 0
'where 0 is the value you are getting from your DB

try changing this value in your DB, I would recommend using a scale like 1 for admin, then 2, 4, 8 etc.

HTH

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > restrict access to a page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway