title: Asp.net MVC Catchall Routing in a Sub Application
body: <p>I have an MVC application with a sub application running another MVC project in IIS. Both use the same version framework and run on separate application pools.</p>
  
  <p>My problem is, I cannot get the sub application to work inside this virtual application folder of the root site. I get a <strong>403.14 Forbidden error</strong>. If I enable directory listing on the sub application I just get a list of the MVC application files.</p>
  
  <p>I think, I have narrowed the problem down to routing; The sub application has a custom catchall route which handles all requests to the site, its a CMS application. There are no other routes registered. Here is the code for my custom route:</p>
  
  <pre><code>RouteTable.Routes.Insert(0,new CmsRoute(
       "{*path}",
       new RouteValueDictionary(new
       {
            controller = "Page",
            action = "Index"
       }),
  
       new MvcRouteHandler()));
  </code></pre>
  
  <p>Running this application outside of the main root application in its own site, it works fine and all requests are handled by my custom route. But as soon as I try run this as a sub application the route handler is never hit.
  If I add the standard default MVC route that comes out of the box:</p>
  
  <pre><code>routes.MapRoute(
       name: "Default",
       url: "{controller}/{action}/{id}",
       defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  );
  </code></pre>
  
  <p>Then MVC kicks in and tries to find a match route for the request. </p>
  
  <p>So my question is why will my catchall route not work while running in a sub application in IIS ?</p>
  
  <p>Note: I have tried prefixing the url in my custom route with the name of the virtual application folder, but it still does not work, example:</p>
  
  <pre><code> RouteTable.Routes.Insert(0,new CmsRoute(
        "subapplication/{*path}",
        new RouteValueDictionary(new
        {
             controller = "Page",
             action = "Index"
        }),
  
         new MvcRouteHandler()));
  </code></pre>