Get AD Account Via asp.net
<p>This might be a simple question. I am creating a website were authentication will be using an AD Account. AD username will be stored in SQL Server Database Table and when a customer tries to open the website it will take his/hers AD Account and make sure it exists in the database and if so it will let them into the website otherwise User Denied. </p>

<p>I have tried using "HttpContext.Current.User.Identity.Name" but that does not get me the user that is trying to run the website it actually just gets the AD Account where the IIS Resides on.</p>

<p>If anyone can show me how I can obtain an AD Account (Username) of who is trying to run my website via .net.</p>

<p><strong>UPDATED</strong><br>
Got the answer: </p>

<p>1) In web.config add:</p>

<pre><code> &lt;authentication mode="Windows"/&gt;  
</code></pre>

<p>2) On the IIS side go under Hosted folder properties<br>
3) Click on Tab "Directory Security"<br>
4) Uncheck all except Itegrated Windows Authentication  </p>

<p>That should work. </p>
