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 363997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:23:46+00:00 2026-05-12T13:23:46+00:00

I have a fairly complex web app that was built (by a contractor) to

  • 0

I have a fairly complex web app that was built (by a contractor) to use integrated authentication. As part of the authentication process, a GetNetworkID() function is used that looks like this:

private string GetNetworkID()
{
    return HttpContext.Current.User.Identity.Name.Split(new char[] { '\\' })[1];
}

When I run this on my development box, the HttpContext.Current.User.Identity.Name value is
myNetwork\\myUserID, so the above funciton returns my User ID, as intended, and the authenticaiton process works just fine.

But when I run this on my web server, I get an Index was outside the bounds of the array error thrown by the return statement in the GetNetworkID() function.

I’m a bit lost on how to troubleshoot this and how to figure out if it’s an IIS configuration issue (my web server is a Windows Server 2008 box running IIS 7), or something else.

If I hard-code my User ID as the return value for the GetNetworkID() function, it works on the web server, but I don’t have any great ideas about how to debug on the web server to determine what the HttpContext.Current.User.Identity.Name return value is that’s causing the array index error.

Any suggestions?

  • 1 1 Answer
  • 2 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-05-12T13:23:46+00:00Added an answer on May 12, 2026 at 1:23 pm

    IIS runs as the IIS Service Account, so Current.User.Identity is likely going to be the name of the IIS Account.

    For completeness sake, you should check for ‘\’ either with a Find() or by calling split, and checking the length of the resultant array. If the length is 1, that means the id isn’t in the form of domain\username.

    In general, if you want to debug, you can write any value to the HTTP Response stream like so:

    Response.Write(HttpContext.Current.User.Identity.Name)
    

    Another method is to setup an ASP page variable, and set the page variable to the value you’d like to inspect. You can display the variable value either through ASP code, or through Javascript.

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

Sidebar

Related Questions

I have a web page that I use to update a fairly complex data
I'm part way through building a fairly complex HTML5 web app, that retrieves its
I have a fairly complex express based web application that is split up into
In my ASP.NET MVC app, I have a fairly complex edit page which combines
I have a fat GUI that it getting fairly complex, and I would like
Hello I have been tasked with creating a fairly complex web application in php,
Background: Our app is a fairly straight forward MVC web app that calls a
I have a fairly complex business application written in ASP.NET that is deployed on
I have a fairly complex method in my controller that basically outputs data to
We have a fairly complex application that was previously using WebForms. We are in

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.