title: C# PrincipalContext Error "Server names cannot contain a space character"
body: <p>I am getting the following error</p>
  
  <p>'Server names cannot contain a space character' when using PrincipalContext to obtain information of a domain user.</p>
  
  <p>This code works locally on my machine but craps out when I load it up on the Intranet web server.</p>
  
  <pre><code>            //GET CURRENT USER 
              String winUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
              string[] domainUsername = winUser.Split(Convert.ToChar(@"\"));
  
              // set up domain context
              PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domainUsername[0]);
  
              // find a user
              UserPrincipal user = UserPrincipal.FindByIdentity(ctx, domainUsername[1]);
  
              return user;
  </code></pre>