title: Angular html5mode with ASP.NET MVC 5
body: <p>In my project, I create a Areas project Admin.</p>
  
  <p>When html5mode is false, url localhost:xxxx/Admin working well.<br>
  But when html5mode is true, it not working and redirect to home.</p>
  
  <pre><code>$locationProvider.html5Mode({
          enabled: true,
          requireBase: false
      });
  </code></pre>
  
  <p>web.config</p>
  
  <pre><code>&lt;rewrite&gt;
              &lt;rules&gt;
                  &lt;rule name="angularjs routes" stopProcessing="true"&gt;
                      &lt;match url=".*" /&gt;
                      &lt;conditions logicalGrouping="MatchAll"&gt;
                          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
                          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
                          &lt;add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /&gt;
                      &lt;/conditions&gt;
                      &lt;action type="Rewrite" url="/" /&gt;
                  &lt;/rule&gt;
              &lt;/rules&gt;
          &lt;/rewrite&gt;
  </code></pre>
  
  <p>HomeController.cs</p>
  
  <pre><code>using System.Web.Mvc;
  
  namespace SuperPaint.Areas.Admin.Controllers
  {
      public class HomeController : Controller
      {
          // GET: Admin/Home
          public ActionResult Index()
          {
              return View();
          }
      }
  }
  </code></pre>
  
  <p>AdminAreaRegistration.cs</p>
  
  <pre><code>using System.Web.Mvc;
  using System.Web.Optimization;
  
  namespace SuperPaint.Areas.Admin
  {
      public class AdminAreaRegistration : AreaRegistration
      {
          public override string AreaName =&gt; "Admin";
  
          public override void RegisterArea(AreaRegistrationContext context)
          {
              RegisterRoutes(context);
              RegisterBundles();
          }
  
          private void RegisterRoutes(AreaRegistrationContext context)
          {
              RouteConfig.RegisterRoutes(context);
          }
  
          private void RegisterBundles()
          {
              BundleConfig.RegisterBundles(BundleTable.Bundles);
          }
      }
  }
  </code></pre>
  
  <p>RouteConfig.cs</p>
  
  <pre><code>using System.Web.Mvc;
  
  namespace Project.Areas.Admin
  {
      internal static class RouteConfig
      {
          internal static void RegisterRoutes(AreaRegistrationContext context)
          {
              context.MapRoute(
                  "Admin_default",
                  "Admin/{controller}/{action}/{id}",
                  new { action = "Index", controller = "Home", id = UrlParameter.Optional },
                  new[] { "Project.Areas.Admin.Controllers" }
              );
          }
      }
  }
  </code></pre>