title: Accessing Application Settings in ASP.NET MVC view
body: <p>I'm trying to build a global menu into my ASP.NET MVC site.master, and I was wondering how I could go about accessing the Application Settings property from the site.master markup?  Previously I probably would have instantiated a config object from my site.master's code-behind and then set a public property.  But now I'm scratching my head...must need more coffee.</p>
  
  <p><strong>UPDATED with answer code</strong></p>
  
  <p>Added a string setting to the application propererties called baseurl and gave it a value of "<a href="http://mysite.com" rel="nofollow noreferrer">http://mysite.com</a>"</p>
  
  <p>Made a model class of GlobalMenu.cs</p>
  
  <pre><code>   public class GlobalMenu
  {
      private string _baseurl;
      public string baseurl
      {
          get { return _baseurl; }
          set
          {
              _baseurl = value;
          }
      }
  
  }  
  </code></pre>
  
  <p>Created a base controller class named BaseController and inherited from Controller, and overroad OnActionExecuted thusly:</p>
  
  <pre><code>     protected override void OnActionExecuted(ActionExecutedContext filterContext)
      {
          string baseurl = Properties.Settings.Default.baseurl;
  
          GlobalMenu menumodel = new GlobalMenu();
          menumodel.baseurl = baseurl;
          ViewData["menudata"] = menumodel;
          base.OnActionExecuted(filterContext);
      }  
  </code></pre>
  
  <p>Created a partial view called ViewGlobalMenu in the Shared folder that was strongly typed to GlobalMenu that looks like this...but with more stuff obviously:</p>
  
  <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl&lt;MyApp.Web.Models.GlobalMenu&gt;" %&gt;
  </code></pre>
  
  
  
  <p>Finally in Site.Master I added this to where I wanted the menu to show:</p>
  
  <pre><code>&lt;%Html.RenderPartial("ViewGlobalMenu", (MyApp.Web.Models.GlobalMenu)ViewData["menudata"]); %&gt;
  </code></pre>