title: Principalcontext error Server names cannot cotain a space character
body: <p>I've issue with an asp page, when I run local from VS the page is fine but in the server not works.
  The is in IIS 7.0 as Application, the page show this errors:</p>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.ArgumentException: Server names cannot contain a space character.</p>
  
  <p>Source Error: </p>
  
  <p>Line 96:         ////Load Ad Info</p>
  
  <p>Line 97:         PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain,container);</p>
  
  <p>Line 98:         UserPrincipal user = UserPrincipal.FindByIdentity(ctx, userName);</p>
  
  <p>The code is fine, follow:</p>
  
  <pre><code>    //Load Ad User
      string[] temp = Convert.ToString(WindowsIdentity.GetCurrent().Name).Split('\\');
      string domainuserName = temp[0] + "\\" + temp[1];
      string userName = temp[1];
      string domain = temp[0];
      lblUserAD.Text = Convert.ToString(userName).ToUpper();
      string container = @"DC=america,DC=ad,DC=flex,DC=com";
  
  
      ////Load Ad Info
      PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain,container);
      UserPrincipal user = UserPrincipal.FindByIdentity(ctx, userName);
  
      DirectoryEntry directoryEntry = user.GetUnderlyingObject() as DirectoryEntry;
  </code></pre>