The following error appears in my web application: "The index was outside the array."
It is strange that the problem only occurs on my web server (Windows Server 2008 R2, .Net 4.0, Windows 7 Enterprise 64 Bit).
When I debug a site in Visual Studio everything works fine
The code is as follows:
I define an array and pass it to the "CheckUserRights" class
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);
The class is as follows:
//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(); } ... ...
I searched for a solution after 4 hours, but cannot find anything. I am not a professional, and I first used arrays.
Could there be a wrong configuration on the server?
I am grateful for any help. Thanks!
Update
Solved, there was a problem in the server configuration. The solution is in response from Steve.
source share