Using ASP.Net MVC3 with C#
I have a rotating ad setup on my layout page.
It is populated by a ViewBag containing the random ad.
Only issue is I need to literally include the Database viewbag code in every controller and action to get it to work on every page.
Is there a way to populate the ViewBag regardless of the controller or action I am on?
I think you could create a BaseController that all of your controllers can inherit from that handles this for you. You could then potentially override the OnActionExecuting event of the BaseController and load the ad into the ViewBag.