I have a unique scenario where I want a base controller to grab some data and store it in a list. The list should be accessible from my views just as ViewData is. I will be using this list on every page and would like a cleaner solution than just shoving it in the ViewDataDictionary.
After attempting to come up with a solution, I thought I would create a custom ViewPage with a property to hold my list. My custom ViewPage would inherit from System.Web.MVC.ViewPage. However, I do not know where MVC passes the viewdata from the controller off to the view. More importantly, how do I get it to pass my list down to the view?
Thanks for the help.
EDIT....
Sorry for the confusion. I was trying to keep the question as simple as possible to avoid any confusion. Obviously, that did not work :)
I'm implementing my own session management in an .net mvc project. When a request comes in, my base controller checks to see if a session cookie was sent along with the request in the OnActionExecuting method. If a session cookie was sent, my controller hits the database and retrieves the user's session information. The session information (userid, etc..) is put into a List object and stored in a property called "Sess".
I want to be able to access elements in the Sess list from my views like this: <%= Sess[0] %>
So, how and where do I get my controller to hand off the Sess list to my views?
I realize that this is not how custom session management is typically implemented in .net. However, this would be the simplest and cleanest solution for my project.
Thanks to everyone who has helped so far!