title: Array: "Index was outside the bounds of the array"
body: <p>I get the following error on my web application: <strong>"Index was outside the bounds of the array."</strong></p>
  
  <p>The strange thing is, that the problem only comes on my webserver (Windows Server 2008 R2, .Net 4.0, Windows 7 Enterprise 64 Bit).</p>
  
  <p>When I debug the site in Visual Studio, it all works perfect</p>
  
  <p>The Code looks like this:</p>
  
  <p>I define an array and give it to the class "CheckUserRights"</p>
  
  <pre><code>string NTLogin = Page.User.Identity.Name.ToString().Split(new char[] { '\\' })[1].ToUpper();
  string[] allowedRoles = new string[2] { "Administrator", "Superuser" };
  CheckUserRights Check = new CheckUserRights(NTLogin, allowedRoles);
  </code></pre>
  
  <p>The class looks like this:</p>
  
  <pre><code>//Lokale Variablen definieren
  string strUserName;
  string strRolename;
  string[] AllowedRoles;
  bool boolAuthorized;
  
  //Im Konstruktor definierte Werte übergeben.
  public CheckUserRights(string Username, string[] Roles)
  {
      this.strUserName = Username;
      this.AllowedRoles = Roles;
      getRoleForUser();
      checkRights();
  }
  ...
  ...
  </code></pre>
  
  <p>I have searched for a solution after 4 hours, but I can't find anything. I am not a pro and that's the first time I have used arrays.</p>
  
  <p>Could it be a wrong configuration on the server?</p>
  
  <p>I am grateful for every help. Thanks!</p>
  
  <p><strong>Update</strong></p>
  
  <p>Solved, there was an problem in the server configuration. Solution is in the answer from Steve.</p>