How do you specify access to admins in web applications?

How do you specify who has access in asp.net applications?  Is it in the web.Config file?  If so, please give me step by step instructions on how to do this.  Thanks!
VBBRettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimSledgeCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KrummelzCommented:
If you're going to use FormsAuthentication (which is probably the easiest)  then you can set up Roles from the Website Administration Tool in VS (Website > ASP.NET Configuration). Then you can assign users to be part of a certain Role. You can then check in your code which Role the currently logged on user is in.

You can also set up folders in your application for specific roles. So that you can seperate pages that are only meant to be viewed by users in a certain role. You then create a web.config in each of these folders which specifies which user roles are allowed access to the pages in the given folder.

Eg. You can create a folder in your project called Admin, and put all the pages that only the Administrators will use, in this folder. Then add a web.config file to that folder, which would contain the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
            <allow roles="Administrator" />
        </authorization>
    </system.web>
</configuration>

Assuming of course that your admin role is called "Administrator".

Here is a Microsoft tutorial, which shows you step by step -> http://www.asp.net/Learn/Security/tutorial-02-vb.aspx
0
VBBRettAuthor Commented:
So when you setup folders specific roles, do you put the admin pages in the admin folder and the regular user pages in the regular user folder?  How do you set it up so the admin has access to everything?  This is interesting to me and this seems a but complex.  Please let me know.  Thanks!
0
KrummelzCommented:
Yes, but for each role you can set up folders. If you want to allow admins to access the other folders too then your config file for the user's folder would look something like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
            <allow roles="User" />
            <allow roles="Administrator" />
        </authorization>
    </system.web>
</configuration>

so that will allow the users and admins to access the contents of that folder..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.