title: Angular.js and IIS reload page
body: <p>I am working on a web app using angular.js and a server-side component deployed on IIS express.<br>
  My problem is that pressing the reload button on the browser will display a 404 message, because obviously, the server does not recognize the URL (managed by angular).</p>
  
  <p>On my app module I have the following:</p>
  
  <pre><code>angular.module('app').config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
      $locationProvider.html5Mode($locationProvider.html5Mode({
          enabled: true,
          requireBase: false
      }));
      $routeProvider.otherwise({ redirectTo: '/login' });
  }]);  
  </code></pre>
  
  <p>Then, in each module I manage the routing for the corresponding pages, e.g.:</p>
  
  <pre><code>angular.module('login', [])
  
  .config(['$routeProvider', function ($routeProvider) {
      $routeProvider.when('/login', {
          templateUrl: 'src/app/login/login.tpl.html',
          controller: 'LoginCtrl',
          resolve: {
          }
      });
  }])
  </code></pre>
  
  <p>My main page is /src/index.html    </p>
  
  <p>I have also tried adding the following rule in the web.config file, but it doesn't work either:  </p>
  
  <pre><code>&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;  
  </code></pre>
  
  <p>Any thoughts? Thanks.    </p>
  
  <p><strong>Update 1:</strong><br>
  I forgot to mention that using the rule above shows the following error when reloading the page.</p>
  
  <p>HTTP Error 403.14 - Forbidden
  The Web server is configured to not list the contents of this directory.</p>