I have my _Layout.cshtml
file that uses the ViewBag
model to render some dynamic content.
I understand ViewBag
can be populated in the controller and accessed in the view and/or layout page.
My question is, if my Layout page is using @ViewBag.SiteName
, I want to avoid having to set this variable in each controller before I return the view. Is there a way to set this variable on a global level? Or how else should I pass this data to the layout page?