Solved

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

Posted on 2013-05-17
5
1,272 Views
Last Modified: 2015-05-21
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
0
Comment
Question by:finance_teacher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 500 total points
ID: 39186589
0
 

Author Comment

by:finance_teacher
ID: 39192066
Do you have any other websites talking about this ?
0
 

Author Comment

by:finance_teacher
ID: 39200055
Please reply.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 40790596
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question