title: Calling controllers in different folders in ASP.NET WebAPI
body: <p>I have an 100% javascript application inside my <code>ASP.NET WebAPI</code> project. This application consumes all the data from my API methods.</p>
  
  <p>Now, I have been requested to create a simple portal built in Razor and HTML also inside my WebAPI project (so like a MVC project).</p>
  
  <p>So I have created a folder under "<strong>Controllers</strong>" folder named "<strong>Portal</strong>" where Im placing all my portal exclusive controllers.</p>
  
  <p>Here is the Controllers structure folders:</p>
  
  <p><img src="https://i.stack.imgur.com/CKk2k.png" alt="enter image description here"></p>
  
  <p>This is my Razor web application views structure:</p>
  
  <p><img src="https://i.stack.imgur.com/nh4Q8.png" alt="enter image description here"></p>
  
  <p>So when I run the application I can see the Login page view (under "<strong>Account</strong>" folder). When I click my Login button, I call my <code>CommonController</code> (Portal) to render a Left menu but I get the error:</p>
  
  <p><img src="https://i.stack.imgur.com/0lDQQ.png" alt="enter image description here"></p>
  
  <p>I guess because I have 2 <code>CommonControllers</code>, but 1 is for serving my javascript application and the other is for my Portal application.</p>
  
  <p>The line in my Index.cshtml that calls the Common controllers is:</p>
  
  <pre><code> &lt;div class="page-header page-header-blue"&gt;
    @Html.Action("Header", "Common")
    &lt;h1&gt;&lt;i class="icon-bar-chart"&gt;&lt;/i&gt; Dashboard&lt;/h1&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In my <code>WebApiConfig.cs</code> I have the following Web Api Route:</p>
  
  <pre><code> config.Routes.MapHttpRoute(
                  name: "DefaultApi",
                  routeTemplate: "api/{controller}/{action}"
              );
  </code></pre>
  
  <blockquote>
    <p>So I don't know how to tell it that I want to call <code>CommonController</code> that is under "<strong>Portal</strong>" folder.</p>
  </blockquote>
  
  <p>Any clue or advice on how to do this and the best practice?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I have create other route for my Portal controllers:</p>
  
  <pre><code> config.Routes.MapHttpRoute(
                 name: "DefaultMvc",
                 routeTemplate: "portal/{controller}/{action}"
             );
  </code></pre>
  
  <p>Seems to work but in my index.cshtml calls : <code>@Html.Action("Header", "Common")</code> how can I tell the action to call <code>Portal Common</code> and not just <code>Common</code> ?</p>