Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:53:29+00:00 2026-06-03T09:53:29+00:00

I get the following error on my web application: Index was outside the bounds

  • 0

I get the following error on my web application: “Index was outside the bounds of the array.”

The strange thing is, that the problem only comes on my webserver (Windows Server 2008 R2, .Net 4.0, Windows 7 Enterprise 64 Bit).

When I debug the site in Visual Studio, it all works perfect

The Code looks like this:

I define an array and give it to the class “CheckUserRights”

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 looks like this:

//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 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.

Could it be a wrong configuration on the server?

I am grateful for every help. Thanks!

Update

Solved, there was an problem in the server configuration. Solution is in the answer from Steve.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:53:31+00:00Added an answer on June 3, 2026 at 9:53 am

    There are many problems in that code, but, sticking to the problem on the question title I think that this line looks suspicious:

    string NTLogin = Page.User.Identity.Name.ToString().Split(new char[] { '\\' })[1].ToUpper();  
    

    what happen if the Page.User.Identity.Name doesn’t contain a DOMAIN\USERNAME?

    Could be rewritten as

    string[] nameparts = Page.User.Identity.Name.ToString().Split(new char[] { '\\' });
    string NTLogin = (nameparts.Length == 2 ? nameparts[1] : nameparts[0]).ToUpper();
    if(NTLogin.Length == 0)
        return;            
    

    Why this property could be the error? Look at this article

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a web-application (using Flask), I get the following error: Unable to retrieve the
I get the following error when attempting to connect to a web service via
I have an .Net MVC 3 web application that has the following structure root
I get following error when deploying on test server with II6 and Framework 3.5
I get following error when trying to access Xampp from a network I've tried
I get following error: 2012-04-04 23:46:18.374 istiqlaltv[17121:e903] -[istiqlaltvViewController moviePlayBackDidFinish]: unrecognized selector sent to instance
I am using the code as described in this question. However get following error
I get the following error: Client does not support authentication protocol requested by server;
I get the following error: Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32
I get the following error on firebug: this._processor is null and the error is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.