title: Get user's full name from active directory in asp.net web application
body: <p>I am trying to get the full name of a given user from active directory. 
  This code works on my PC but when I put it on the server it throws exception:</p>
  
  <p>The network path was not found. </p>
  
  <p>The code is:       </p>
  
  <pre><code>DirectoryEntry obDirEntry = null;
          try
          {
              obDirEntry = new DirectoryEntry("WinNT://" + "domain" + "/" + Environment.UserName);
              System.DirectoryServices.PropertyCollection coll = obDirEntry.Properties;
              object obVal = coll["FullName"].Value;
              Response.Write(obVal);
          }
          catch (Exception ex)
  
          {
             Response.Write(ex.Message);
          }
  </code></pre>
  
  <p>Any idea how to fix so it would work on the server also? Or maybe some other way I can get the full name of a given user name? Do I need to use LDAP instead somehow?</p>