title: Intranet Usernames will have different string representing them
body: <p>I am working on an Intranet asp.net mvc web application. And I am getting different Username formats from different classes. For example on a Create Post action method I am getting the username for the current login user, and assign it to the CreatedBy field as follow:-</p>
  
  <pre><code>public ActionResult Create(Group group)
          {try
              {if (ModelState.IsValid) {
  Group.CreatedBy = User.Identity.Name;
                      repository.InsertOrUpdateGroup(group);
                      repository.Save();
                      repository.InsertOrUpdateAudit(auditinfo);
  </code></pre>
  
  <p>The User.Identity.Name will be something such as :- <code>domainname\username</code></p>
  
  <p>While if on another action method I want to retrieve a list of all Active directory usernames and I use the following:-</p>
  
  <pre><code>List&lt;DomainContext&gt; results = new List&lt;DomainContext&gt;();
  using (var context = new PrincipalContext(ContextType.Domain, "WIN-SPDEV"))
  using (var searcher = new PrincipalSearcher(new UserPrincipal(context))) {
  var searchResults = searcher.FindAll();
  foreach (Principal p in searchResults) {
  DomainContext dc = new DomainContext();
  dc.DisplayName = p.DisplayName;
  dc.userGuid = p.UserPrincipalName;
  </code></pre>
  
  <p>Then the UserPrincipleName will be <code>user1@domainname.local</code> and not <code>doaminname\username</code>. So in this way I will have different strings representing the same active directory user. 
  So is there a way to make all usernames standard, regardless of the method I am assigning or retrieving them ?</p>