I have a user model that contains things like login name, name, permissions, contact info, etc.
I want to display the user's name in the menu bar of my _Layout page so it's displayed across every page. I can display the logged in user like this in my _Layout page...
@User.Identity.Name.Replace(@"MYDOMAIN\", "")
But I want to pull the users real name from the model, and get their permissions to manage what they can and can't see on the company Intranet site.
The problem is, if I try to set the page model in the _Layout page, the site blows up because the @RenderBody in the _Layout loads other pages that reference their own models.
Maybe I'm looking at this wrong, but how else would you maintain the user name and permissions across your site without having each page hit the database every time you went to a new page?
Another way to look at it... Suppose your menu is data driven, and the menu exists in the _Layout page. How do you do that?
Thanks.