title: ASP.Net Impersonation to pass connection string to SQL Server database
body: <p>I am building a webpage using Visual Studio 2013 that I want to run internally on my intranet (IIS 8.5) and take advantage of windows authentication or NTLM.</p>
  
  <p>My webpage needs to contain SQL Server connection strings but I want the connection to SQL Server to use the currently logged in user that I can get via windows authentication.</p>
  
  <p>I know that I need to use impersonation to achieve this but I am not sure how, is anyone able to point me in the right direction? </p>
  
  <p>I know my <code>web.config</code> needs to contain</p>
  
  <pre><code>&lt;authentication mode="Windows" /&gt;
  &lt;identity impersonate="true" /&gt;
  </code></pre>