Welcome to Jtech!


You are not logged in.
Login

Menu

ASP.Net Roles

Let's take a moment to mention ASP.Net 'Roles'.

'Roles' are not required for a very simple access page using the Login Control. - But sooner or later, you'll probably want to use them once you understand them.

Let's say we have a 'private' area on our website that we want to grant access to users if the can successfully log in.

However, we also may have an area within the 'private' area we will grant access only to certain persons who log in. - For the sake of discussion, let's say this is an 'admin' area (for administrators).

First of all, our directory tree will look something like this:

Looking at the tree, the folder '/httpdocs' is the website's 'root'. - It is a 'public' area for anybody to see.

The folder '/httpdocs/private/' is where we keep all of our 'private' files located.

The folder '/httpdocs/private/admin/' is an area in our 'private' area where only certain users (who have the correct permission) can access files (in addition to files in the '/httpdocs/private' folder).

We will do this by setting up two roles. - One for all users who successfully log in. - We'll call this role private_access. - Everybody who is registered will belong to this 'role'.

The other role we'll call 'administration'. - This is for certain users who only have access to this area. - See below:

Roles
private_access administration
pvt_user1 X
admin X X

In the above, 'pvt_user1' belongs to the 'private_access' role and 'admin' belongs to both the 'private_access' and 'administration' roles. - 'pvt_user1' cannot access anything in the 'administration' area. - You'll understand this much better in the next web page.

I hope you see how 'roles' can help you manage your private area(s) as they grow. - It's simple to allow or dissalow a 'role' access to various areas without changing the access rule(s) for each and every user.

Let's move on and create the .aspx files we'll need and load our ASP.Net tables in SQL wit some user data. - Then we can play with the login control.

Previous - ASP.Net web.config file Next - Setting up Logins