chris
chris

Reputation: 37460

asp.net mvc 1.0: How can you implement dynamic, role-based navigation?

Building an application, and there will be different levels of access.

What is the recommended way to restrict the display of navigation elements to those appropriate to the current user? Are there any built-in helper for this?

Upvotes: 1

Views: 988

Answers (1)

Nate
Nate

Reputation: 30636

I asked a similar question here. There are a few options, depending on your needs something as simple as checking User.Identity.IsInRole("xyz") in the view may suffice (not ideal, but it gets the job done).

If you have a complex navigation structure, the answers provided in my question maybe of use to you.

I should point out that as @casperOne has mentioned, the [Authorize] attribute will prevent unauthorized access to the actions in question, but will not help with the display of menu navigation to them.

Upvotes: 1

Related Questions