title: ASP.NET MVC - Set Master View accordingly with Controller
body: <p>By any chance, is there any easy way to set a default MasterView for all the actions inside a specific controller?</p>
  
  <p>For example If I have the <b>HomeController</b> I want all the actions inside it to inherit the <b>Site.Master</b> as default, but If I am inside <b>AccountsController</b> I want all the action to inherit the <b>Admin.Master</b> and so on..</p>
  
  <p>I managed to do it with:</p>
  
  <pre><code>return View("viewName", "masterName", objectModel);
  </code></pre>
  
  <p>But by doing this I have to apply it every time I call the View method.</p>
  
  <p>I was looking for something simpler like on rails where we can declare:</p>
  
  <pre><code>class HomeController &lt; ApplicationController
  
    layout 'site'
  
     def index
     end
  
     def create
     ...
  
  end
  
  class AccountsController &lt; ApplicationController
  
    layout 'admin'
  
    def index
    end
  
    def create
    ...  
  
  end
  </code></pre>
  
  <p>Is that possible?</p>
  
  <p>Thanks in advance</p>