Building an MVC 3 app with Razor and I have some information persisted in the Session scope that will be used in the _Layout file.
I have no clue as to what is the best way to implement this. Some of this information is used to determine what is rendered in the header.
I have a CurrentUser object stored in Session scope
An easier way to do it is using
Session
property directly from the view (HttpContext.Current.
prefix should not be necessary at all):You could just access the HttpContext in the layout file
or, if you want access to the user object you could just create an object in the page and assign it
Then later in your code...