I'm creating an ASP.NET MVC4 application which has a left menu panel, and the right main panel will be the content panel. (@RenderBody
)
The links on the menu are generated based on the login role of the user. E.g., users with higher access will see more links on the menu. These access rights are stored in the database.
I have a _Layout.cshtml
page which all my pages inherit from.
How should I code my access menu such that the access is retrieved only from the database once, during login? There after, every page the user navigates to, I won't have to re-query the database for his access rights.
Should I use Html.RenderAction
or Html.Partial
for my access menu page?