Look it this Code: is user for to retrive the Current Window User From Active Directory in C#
<pre><code>void checkUser()
{
       string principal = this.Context.User.Identity.Name;

        string filter = string.Format("(&amp;(ObjectClass={0})(sAMAccountName={1}))", "person", principal); 

        string domain = "DOMAIN";
        string[] properties = new string[] { "fullname" };

        DirectoryEntry adRoot = new DirectoryEntry("LDAP://xxx/OU=xxx Users OU, DC=xxx, DC=LOCAL" + domain, null, null, AuthenticationTypes.Secure); 

        DirectorySearcher searcher = new DirectorySearcher(adRoot); 
        MessageBox.Show(principal);
    }
</code></pre>
