title: How to use custom Errors page in Windows Authentication
body: <p>I am using asp.net 3.5 web.config to limit access and it works great.</p>
  
  <pre><code>&lt;authentication mode="Windows"&gt;
  &lt;authorization&gt;
      &lt;allow users="Bill, John"/&gt;
      &lt;deny users="*"/&gt;
  &lt;/authorization&gt;
  </code></pre>
  
  <p>Unauthorized (but authenticated) users will be blocked by a system error message saying that:</p>
  
  <pre><code>Server Error in '/' Application
  Access is denied.
  Description: An error occurred while .......
  Error message 401.2: Unauthorized: Logon failed due to server configuration ...
  </code></pre>
  
  <p>In order to make the message more friendly, I uncomment the customErrors flag and create a GenericErrorPage.htm in the root path of my project.</p>
  
  <pre><code>&lt;customErrors mode="On" defaultRedirect="GenericErrorPage.htm"&gt;
      &lt;error statusCode="403" redirect="NoAccess.htm" /&gt;
      &lt;error statusCode="404" redirect="FileNotFound.htm" /&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>However, it just doesn't work. I still get the system error message rather than my custom error page.</p>
  
  <p>Any suggestions will be appreciated.</p>