Fist Solution: Controlling a link based on permission
AuthorizeActionLink: This only renders a link in the menu if user has access to it. You can customize the code to print any kind of HTML in the place of anchor tag if user does not have access. Check this
out[
^].
For a more flexible solution, check this
out[
^].
Second Solution: Multiple links at once for a dropdown menu
For a dropdown menu, best way to implement would be to create a model:
public class MenuLink
{
public string Name { get; set; }
public string Link { get; set; }
public List<menulink> Children { get; set; }
}
</menulink>
You can then populate children based on the links that have permissions. If no links have permission, then you can decide to hide that dropdown menu altogether. You can rework the code from
here[
^] to populate the list based on permission.
Hopefully this gets you started. Let me know if you have any questions.
Third Solution: Google
Upon a
Google Search[
^] I found good solutions. Check them out, see if they help.