title: Exclude specific path from WIF authorization in a ASP.NET MVC 4 project
body: <p>We have successfully configured windows identity foundation (WIF) in our ASP.NET 4.5 MVC 4 project with the help of the <strong>Identity and Access...</strong> extension for Visual Studio 2012. But are unable to exclude a specific path from authorization to allow anonymous access.</p>
  
  <p>When we access our default route (i.e. <code>/Home</code>), the passive redirection will redirect us to the configured issuer Uri. This is currect. But now assume we want to exclude Path <code>/Guest</code> from STS Authentication so that everybody can access <code>http://ourhost/Guest</code> without beeing routed to the STS issuer. Only static documents are located there.</p>
  
  <p>Snippets from <code>Web.config</code>:</p>
  
  <pre><code>&lt;system.identityModel&gt;
    &lt;identityConfiguration&gt;
      &lt;audienceUris&gt;
        &lt;add value="http://ourhost/" /&gt;
      &lt;/audienceUris&gt;
      &lt;issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;
        &lt;trustedIssuers&gt;
          &lt;add thumbprint="9B74****40D0" name="OurSTS" /&gt;
        &lt;/trustedIssuers&gt;
      &lt;/issuerNameRegistry&gt;
      &lt;certificateValidation certificateValidationMode="None" /&gt;
    &lt;/identityConfiguration&gt;
  &lt;/system.identityModel&gt;
  &lt;system.identityModel.services&gt;
    &lt;federationConfiguration&gt;
      &lt;cookieHandler requireSsl="false" /&gt;
      &lt;wsFederation passiveRedirectEnabled="true" issuer="http://oursts/Issue" realm="http://ourhost/" reply="http://ourhost/" requireHttps="false" /&gt;
    &lt;/federationConfiguration&gt;
  &lt;/system.identityModel.services&gt;
  </code></pre>
  
  <p>Further we have...</p>
  
  <pre><code>&lt;system.webServer&gt;
    &lt;!-- ... --&gt;
    &lt;modules runAllManagedModulesForAllRequests="true"&gt;
      &lt;add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /&gt;
      &lt;add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /&gt;
      &lt;remove name="FormsAuthentication" /&gt;
    &lt;/modules&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>and finally:</p>
  
  <pre><code>&lt;system.web&gt;
    &lt;!-- ... --&gt;
    &lt;authentication mode="None" /&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>We tried the following without success:</p>
  
  <pre><code>&lt;location path="~/Guest"&gt; &lt;!-- also "/Guest" is not working --&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>We also tried to put a small Web.config file into this folder, without success. No matter which Uri we locate to in the browser, we're always redirected.</p>
  
  <p>What is the proper way to accomplish this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Removed the previous "accepted answered", set "accepted answer" to <a href="https://stackoverflow.com/a/13296455/265165">Eugenios answer</a> as this is the more useful reply.</p>