title: ASP.Net web application trying to use Impersonation and Delegation to connect to SQL Server
body: <p>I'm trying to use Impersonation and Delegation in an intranet ASP.Net web-app in order to pass authenticated users' credentials onto a SQL Server.</p>
  
  <p>The web server and SQL server are two separate machines, but in the same domain, so Delegation is required.</p>
  
  <p>I've done the following:</p>
  
  <ul>
  <li>set <code>&lt;authentication mode="Windows"/&gt;</code> and <code>&lt;identity impersonate="true"/&gt;</code> in my web-app's web.config.</li>
  <li>enabled Constrained Delegation from the web server to the MSSQLSvc service on the SQL Server, in Active Directory.</li>
  <li>enabled only Windows Authentication in the website, through IIS.</li>
  </ul>
  
  <p>Apparently this should all work, but it doesn't (the SQL Server is denying access to the anonymous user - "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'").</p>
  
  <p>In IIS7, the Application Pool is set to use Integrated Pipleline Mode and is running with the NetworkService Identity. The website only has Windows Authentication enabled, Extended Protection is Off, Kernel-mode authentication is enabled, and NTLM is the provider.</p>
  
  <p>All the web pages I've read seem to indicate that my setup should work. What am I missing?</p>