title: Defining a forms auth path erratically redirecting to ReturnUrl after logon
body: <p>I'm having a very erratic problem with forms auth I'm hoping someone can shed some light on. Here's what's in the web.config:</p>
  
  <pre><code>&lt;location path="Admin"&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;deny users="?"/&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>And for the auth:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Admin/LogOn.aspx" name="MyAppAdmin" requireSSL="false" path="/Admin" cookieless="UseCookies"/&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>There's also a custom membership provider implementing ValidateUser against a credential repository. The app has a master page with a LoginName control.</p>
  
  <p>What seems to be happening is that sometimes a user logs on successfully but the logon page remains rather than redirecting them to the ReturnUrl in the query string. We know they've successfully authenticated because the LoginName control shows their identity and they can always browse off to other secured content.</p>
  
  <p>Unfortunately we can't identify the pattern which causes this. Different browsers, different servers, removing cookies, SSL or no SSL; there's no discernible pattern. The only thing which <strong><em>is</em></strong> clear is that after removing the "path" attribute from the forms node the problem couldn't be reproduced.</p>
  
  <p>Is there anything obviously wrong with this configuration? Any thoughts on a possible cause? Obviously the path attribute isn't essential but it's nice to isolate things a bit further.</p>