Click to See Complete Forum and Search --> : asp security


minority
06-29-2005, 03:04 AM
Can anyone help with how and best way to implement asp security into my web pages?

I require to make it so that there is a basic login and 2 different type of admins and how to check against each of them to ensure they have access to that specific area

buntine
06-29-2005, 03:15 AM
Use a session variable (or two) that stores a certain clearance level (1 or 2, in your case). When the user loads a page, you could have a security check similar to the one below:

Const SECURITY_CLEARANCE = 2

If Not IsNumeric(Session("Clearance")) Or Session("Clearance") = "" Then
'| User is not even signed in! You could redirect them to the login here.
End If

If CInt(Session("Clearance")) < SECURITY_CLEARANCE Then
'| User is logged in but oes not have access to this section.
Response.Write "Sorry, you are not authorized to view this section."
End If

The "Clearance" session variable would be initially created when the user logs into the system.

Regards.