| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > restrict access to a page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|