title: How can I create a global variable and make it available to all views in ASP.NET MVC 5 framework?
body: <p>I have an application that is written on the top of the ASP.NET MVC 5 framework.</p>
  
  <p>I created a base controller where all of my controllers inheres. My base controller looks like this</p>
  
  <pre><code>[Authorize]
  public class BaseController : Controller
  {
      protected IFlashManager Flash { get; set; }
      protected ICookie Cookie { get; set; }
      protected ICacheClient Cache { get; set; }
  
      protected override void Initialize(RequestContext requestContext)
      {
          base.Initialize(requestContext);
  
          Cookie = new CookieJar(requestContext.HttpContext);
          Flash = new FlashManager(TempData);
          Cache = new StackExchangeRedisCacheClient(new NewtonsoftSerializer());
      }
  }
  </code></pre>
  
  <p>I want to make the <code>Cookie</code> and <code>Cache</code> objects available globally to all of my views.</p>
  
  <p>Microsoft have done the same thing with the <code>User</code> object.</p>
  
  <p>Is there a way I can do this without using <code>ViewBag</code> or <code>TempData</code>?</p>