title: detecting asp.net redirecting users to login page
body: <p>i have a directory in my website that is protected from anonymous users. my web.config looks like this</p>
  
  <pre><code>&lt;location path="members"&gt;
      &lt;system.web&gt;
          &lt;authorization&gt;
              &lt;allow roles="members" /&gt;
              &lt;deny users="*" /&gt;
          &lt;/authorization&gt;
      &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>if anonymous users try to access pages in the "/members" directory they will be redirected to the login page.</p>
  
  <p>from the codebehind on the login page, <strong>is there a way to tell the difference</strong> between a user being redirected this way versus the user manually going to the login page? (either by typing in the url or clicking on a link to the login page)</p>
  
  <p>i know the web is stateless so perhaps these two requests are indistinguishable</p>
  
  <p>if it's not possible to distinguish between the two, is there a way to intercept what happens before .net decides to redirect the user because of an unauthorized access attempt?</p>
  
  <p>note: i can't use the "ReturnUrl" in the querystring because i will decorate it the same way</p>