title: Domain Login, asp.net
body: <p>I need clarification how to apply domain login in my asp.net application.</p>
  
  <p>So I have following architecture: Three machines: at one is working asp.net application, another one is database server, and from last machine I am accessing application.</p>
  
  <p>My application should work like this: I am accessing application from last machine it takes my domain name check if it exists in the user table and it should authenticate me. 
  But it works only when application is running at one machine and I am accessing application from the same one. It is connected with that impersonation in web.config file give me access only to <strong>local</strong> resources.</p>
  
  <p>I find some articles at MSDN but they are too complex to apply and understand: </p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/ff647076.aspx" rel="nofollow">Explained: Windows Authentication in ASP.NET 2.0</a>   </li>
  <li><a href="http://msdn.microsoft.com/en-us/library/ms998355.aspx" rel="nofollow">How To: Use Protocol Transition and Constrained Delegation in
  ASP.NET 2.0</a></li>
  <li>How To: Create a Service Account for an ASP.NET 2.0 Application  </li>
  <li>Building Secure ASP.NET Applications: Authentication, Authorization,
  and Secure Communication</li>
  </ul>
  
  <p>From these articles I know that solution should use kerberos, delegation and impersonation. But I have no idea how to apply it.</p>
  
  <p>What I have to do to implement domain login in my application? Do you have a nice tutorial how to do it? Do I have to modify only my application code or configuration of server (second machine)?</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>I logged some information:</p>
  
  <p><strong>On my machine:</strong></p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name
  </code></pre>
  
  <p>Returns: [myDomainName][myUserName]</p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().AuthenticationType
  </code></pre>
  
  <p>Returns: Kerberos</p>
  
  <p><strong>On three machines architecture:</strong></p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name
  </code></pre>
  
  <p>Returns: [IIS APPPOOL][ApplicationName]</p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().AuthenticationType
  </code></pre>
  
  <p>Returns: Negotiate</p>