title: ASP.NET MVC Routing: Need to use Index in URL despite it being declared in defaults (using Areas)
body: <p>I have searched but no solutions seem to work for me.
  I have a web forms VS2013 solution and I've been adding MVC to this using an Area. 
  I have got everything working when I specify e.g.: <code>http://localhost:51961/MVC/contractfiles/index/</code></p>
  
  <p>This works fine, but I need it to go to the same page when i use:</p>
  
  <pre><code>http://localhost:51961/MVC/contractfiles/
  </code></pre>
  
  <p>instead I get HTTP Error 403.14 - Forbidden - The Web server is configured to not list the contents of this directory.</p>
  
  <p>My Area registration is:</p>
  
  <pre><code>    namespace PublicHealthCMS_L3.Areas.MVC
      {
          public class MVCAreaRegistration : AreaRegistration 
          {
              public override string AreaName 
              {
                  get 
                  {
                      return "MVC";
                  }
              }
  
              public override void RegisterArea(AreaRegistrationContext context) 
              {
                  context.MapRoute(
                      "MVC_default",
                      "MVC/{controller}/{action}/{id}",
                      new { action = "Index", id = UrlParameter.Optional },
                      namespaces: new[] {"PublicHealthCMS_L3.Areas.MVC.Controllers" }
                  );
              }
          }
      }
  </code></pre>
  
  <p>And my contractfiles controller:</p>
  
  <pre><code>namespace PublicHealthCMS_L3.Areas.MVC.Controllers
  {
      public class ContractFilesController : Controller
      {
          private PublicHealthCMSEntitiesMVC db = new PublicHealthCMSEntitiesMVC();
  
          // GET: MVC/ContractFiles
          public ActionResult Index()
          {
              int ContractID = MySession.Current.ContractID;
              return View(db.pr_File_Select(242).ToList());
          }
  </code></pre>
  
  <p>Thanks for any help</p>
  
  <p>Main route: </p>
  
  <pre><code>namespace PublicHealthCMS_L3
  {
      public class RouteConfig
      {
          public static void RegisterRoutes(RouteCollection routes)
          {
              routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
              routes.MapRoute(
                  name: "Default",
                  url: "{controller}/{action}/{id}",
                  defaults: new { controller = "contractfiles", action = "Index", id = UrlParameter.Optional },
                  namespaces: new string[] { "PublicHealthCMS_L3.Controllers" }
              );
  
              //.DataTokens = new RouteValueDictionary(new { area = "MVC" } );
  
          }
      }
  }
  </code></pre>
  
  <p>Global.asax Application_Start</p>
  
  <pre><code>void Application_Start(object sender, EventArgs e)
          {
              // Code that runs on application startup     
              AreaRegistration.RegisterAllAreas();
              GlobalConfiguration.Configure(WebApiConfig.Register);
              RouteConfig.RegisterRoutes(RouteTable.Routes);            
  
  
              //RegisterRoutes(RouteTable.Routes);
  
          }
  </code></pre>
  
  <p>I also have some webapi routes, WebApiConfig.cs:</p>
  
  <pre><code>namespace PublicHealthCMS_L3
  {
      public static class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              config.MapHttpAttributeRoutes();
  
              config.Routes.MapHttpRoute(
                  name: "DefaultApi",
                  routeTemplate: "api/{controller}/{id}",
                  defaults: new { id = RouteParameter.Optional }
              );
          }
      }
  }
  </code></pre>
  
  <p>web.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    --&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;
        &lt;section name="PublicHealthCMS_L3.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" /&gt;&lt;/configSections&gt;
    &lt;appSettings&gt;
      &lt;add key="RouteDebugger:Enabled" value="false"/&gt;
      &lt;add key="MessageNoContractSelected" value="No contract is selected, please click Search and select a contract" /&gt;
      &lt;add key="MessageDeleteRecordFilesExist" value="This record has associated files, please expand the record and remove the files first before the record can be deleted" /&gt;
      &lt;add key="Version" value="1.02" /&gt;
    &lt;add key="RouteDebugger:Enabled" value="true" /&gt;&lt;/appSettings&gt;
    &lt;connectionStrings&gt;   
      &lt;add name="PublicHealthCMSConnectionString" connectionString="Data Source=bcvPHDEVSQL;User Id=PublicHealth_User; Password=;Initial Catalog=PublicHealthCMS;" providerName="System.Data.SqlClient" /&gt;
      &lt;add name="PublicHealthCMSEntities" connectionString="metadata=res://*/CRMModel.csdl|res://*/CRMModel.ssdl|res://*/CRMModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=BCVPHDEVSQL;initial catalog=PublicHealthCMS;User Id=PublicHealth_User; Password=;multipleactiveresultsets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
      &lt;add name="PublicHealthCMSEntitiesMVC" connectionString="metadata=res://*/Areas.MVC.Models.CMSModel.csdl|res://*/Areas.MVC.Models.CMSModel.ssdl|res://*/Areas.MVC.Models.CMSModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=bcvPHDEVSQL;initial catalog=PublicHealthCMS;user id=PublicHealth_User;password=;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
    &lt;/connectionStrings&gt;
  
    &lt;system.web&gt;
      &lt;httpRuntime maxRequestLength="20480" /&gt;
      &lt;httpHandlers&gt;
        &lt;add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" /&gt;
      &lt;add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" /&gt;&lt;/httpHandlers&gt;
      &lt;compilation debug="true" targetFramework="4.5"&gt;
        &lt;assemblies&gt;
          &lt;!--&lt;add assembly="System.Data.Entity, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;--&gt;
          &lt;add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&gt;
          &lt;add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&gt;
          &lt;add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&gt;
          &lt;add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&gt;
        &lt;/assemblies&gt;
        &lt;buildProviders&gt;
          &lt;add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&gt;
        &lt;/buildProviders&gt;
      &lt;/compilation&gt;
      &lt;authentication mode="Windows"&gt;
      &lt;/authentication&gt;
      &lt;authorization&gt;
        &lt;deny users="?" /&gt;
        &lt;!-- This denies access to the Anonymous/unregistered user --&gt;
        &lt;allow users="*" /&gt;
        &lt;!-- This allows access to all registered users --&gt;
      &lt;/authorization&gt;
      &lt;identity impersonate="false" /&gt;
  
      &lt;pages controlRenderingCompatibilityVersion="4.0"&gt;&lt;/pages&gt;
    &lt;!-- Glimpse: This can be commented in to add additional data to the Trace tab when using WebForms
          &lt;trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/&gt; --&gt;&lt;httpModules&gt;
              &lt;add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" /&gt;
          &lt;/httpModules&gt;&lt;/system.web&gt;
    &lt;system.webServer&gt;
  
      &lt;!--&lt;directoryBrowse enabled="true" /&gt;--&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"&gt;&lt;add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" /&gt;&lt;/modules&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
      &lt;handlers&gt;
        &lt;add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&gt;
        &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
        &lt;remove name="OPTIONSVerbHandler" /&gt;
        &lt;remove name="TRACEVerbHandler" /&gt;
        &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
  
  
  
        &lt;!-- Your other remove tags--&gt;
        &lt;!--
        &lt;remove name="UrlRoutingModule-4.0" /&gt;
         --&gt;
        &lt;!--Your other add tags--&gt;
        &lt;!--
        &lt;add name="UrlRoutingModule-4.0" path="*" verb="*" type="System.Web.Routing.UrlRoutingModule" preCondition="" /&gt;--&gt;
      &lt;add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" /&gt;&lt;/handlers&gt;
      &lt;defaultDocument&gt;
        &lt;files&gt;
          &lt;!--&lt;add value="Search.aspx" /&gt;--&gt;
          &lt;add value="Index.cshtml" /&gt;
        &lt;/files&gt;
      &lt;/defaultDocument&gt;
    &lt;/system.webServer&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings /&gt;
      &lt;client /&gt;
    &lt;/system.serviceModel&gt;
    &lt;applicationSettings&gt;
      &lt;PublicHealthCMS_L3.Properties.Settings&gt;
        &lt;setting name="PublicHealthCMS_L3_ActiveDirectory_ActiveDirectory" serializeAs="String"&gt;
          &lt;value&gt;http://bcvmbiis02/tools/ActiveDirectory.asmx&lt;/value&gt;
        &lt;/setting&gt;
      &lt;/PublicHealthCMS_L3.Properties.Settings&gt;
    &lt;/applicationSettings&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&gt;
        &lt;parameters&gt;
          &lt;parameter value="mssqllocaldb" /&gt;
        &lt;/parameters&gt;
      &lt;/defaultConnectionFactory&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
  
  &lt;glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd"&gt;
        &lt;!-- 
            For more information on how to configure Glimpse, please visit http://getglimpse.com/Help/Configuration
            or access {your site}/Glimpse.axd for even more details and a Configuration Tool to support you. 
        --&gt;
      &lt;/glimpse&gt;&lt;/configuration&gt;
  </code></pre>
  
  <p>Also, the web.config within the MVC area:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
        &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  
    &lt;system.web.webPages.razor&gt;
      &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
        &lt;namespaces&gt;
          &lt;add namespace="System.Web.Mvc" /&gt;
          &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
          &lt;add namespace="System.Web.Mvc.Html" /&gt;
          &lt;add namespace="System.Web.Routing" /&gt;
          &lt;add namespace="PublicHealthCMS_L3" /&gt;
  
        &lt;/namespaces&gt;
      &lt;/pages&gt;
    &lt;/system.web.webPages.razor&gt;
  
    &lt;appSettings&gt;
      &lt;!--&lt;add key="webpages:Enabled" value="false" /&gt;--&gt;
    &lt;/appSettings&gt;
  
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;handlers&gt;
        &lt;remove name="BlockViewHandler"/&gt;
        &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>