ASP.NET: Different Role --> Different versions of the same page?

Hello experts,

I have an asp.net application on my company's intranet. I am using windows authentication to capture the user's identity and active directory group. My application knows these AD groups as roles. I want to have three versions of an asp.net webform, each version tied to only a specific role.

There would be a data entry role that can only see the most limited page, a supervisor role that sees supervisory information that the data entry role cannot see, and an admin role that can see everything from the other two roles in one screen. How would I make it so that my application checks to see what role a user is part of, and based on that role decide what page to show them?

note: I already know that I can create folders in my website and give those folders their own web.config files that restrict use of a page to a specific role, and that isn't what I want to do, because then I would have to have three links for a user to click on and block certain links based on role. I want the user to AUTOMATICALLY come to the correct page for them based on their role and not ever have the option of clicking on the pages / folders of the other roles.

Please advise,
thank you
dantchoAsked:
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.

Alfred A.Commented:
Hi,

My suggestion is for you to redirect all users to a single intermediate page (in the page load for example) that inspects the user role and then appropriately, redirect a user again to the proper asp.net web page.

0
Alfred A.Commented:
Hi,

Just some additional comment, I am providing a code snippet example for you to get an idea:

Page_Load in intermediate page:

protected void Page_Load(object sender, EventArgs e)
    {
        if(User.IsInRole("Manager"))
        {
            Response.Redirect("Manager.aspx");
        }
        else
        {
            Response.Redirect("Employee.aspx");
         }
    }
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
dantchoAuthor Commented:
Excellent, simple to follow example and clearly explained.
0
dantchoAuthor Commented:
Perfect, tried and this does exactly what I wanted. Thank you very much for your help!
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
ASP.NET

From novice to tech pro — start learning today.