I’m trying to figure out how to show/hide links for users based on their roles. I know how to set the authorize attribute for an action method, but I’m having trouble making links show hide in a view if the user is say, an admin or a manager in my roles database.
Any good articles or code example someone can point me towards?
In your view you can reference the
IPrincipaluser through theSystem.Web.Mvc.ViewPage‘sUserproperty.E.g. In your view you can have something like:
HTHs,
Charles