Link to home
Create AccountLog in
Avatar of finance_teacher
finance_teacher

asked on

ASP.Net MVC 4 C# -- role based menu items ?

I read some of the below articles and want the easiest
way to implement "role based menu items" that appear
in "_Layout.cshtml"
  ** http://techbrij.com/role-based-menu-asp-net-mvc
  ** http://www.fluentsecurity.net
  ** http://forums.asp.net/t/1761556.aspx/1
  ** http://nugetmusthaves.com/Tag/membership

What do you recommend since before I start creating this APP ?

Steps
 1. New Project
 2. ASP.Net MVC 4 C#
 3. Basic, Razor
 4. add users via VS2010 WSAT (easy, I like this security)
 5. run app
 6. works
 7. change below _Layout.cshtml

                    <nav>
                        <ul id="menu">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>

                            [Authorize(Roles = "Administrator")]
                            <li>@Html.ActionLink("About", "About", "Home")</li>

                            [Authorize(Roles = "Everyone")]
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
 8. run app
 9. get attached failure --> should HIDE About and Contract buttons since not logged in
ASKER CERTIFIED SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of finance_teacher
finance_teacher

ASKER

Do you have any other websites talking about this ?
Please reply.
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.