[Last Call] Learn how to a build a cloud-first strategyRegister Now


ASP.net Error

Posted on 2014-08-18
Medium Priority
Last Modified: 2014-08-25
Hi My sharepoint application geeting error below
Page Load -Index was outside the bounds of the array,Can some one show me where is error generating,
This is generating only one person machine (browser) other every one working fine. i can't debug the programme becuase its in the client side.No access at all.But i can see the error using in the error Table.( i generated Table for any error goes to that table)

 protected void Page_Load(object sender, EventArgs e)
                LblUserLoginError.Visible = false;
                ConnectionOpen = new Site();
                LoginRights UsernameFind = new LoginRights();

                string[] CurrentUsername = UsernameFind.CurrentUserName().Split('\\');

                //  public int SalesLoginRights(string Username, string Country,out string SalesID)

                string[] HomeBackGlobal = Regex.Split(HttpContext.Current.Request.Url.ToString(), "http://");
                string Test_SalesPagePath = "~/_layouts/Test_Global/Test_Sales.aspx?Hm=" + HomeBackGlobal[1];
                //Image_Country.ImageUrl =ConnectionOpen.CountryFlag( LblCountry.Text.ToString());
                LinkDashBoard.Text = "DashBoard -" + LblCountry.Text.ToString();

                //HttpContext context = HttpContext.Current;
                PropertyInfo isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);
                if (!((Page)System.Web.HttpContext.Current.CurrentHandler).IsPostBack)

                    if (HttpContext.Current.Request.QueryString["SalesID"] != null)
                        string tempValue = HttpContext.Current.Request.QueryString["SalesID"].ToString();
                        LblSalesID.Text = tempValue;

                        if (LblSalesID.Text.ToString() != "")
                            Sales FindTestName = new Sales();
                            string SalesPerosnFullname = FindTestName.SalesPersonName(LblSalesID.Text.ToString(), LblCountry.Text.ToString());

                            if (UserLoginType() == 1 || UserLoginType() == 3)

                                Sales cl_SalesPersons = new Sales();

                                DataTable tbSalesPerson = cl_SalesPersons.ConvertListToDataTable(cl_SalesPersons.FillAllSalesPerson(LblCountry.Text.ToString()));
                                DropDownTest.DataSource = tbSalesPerson;

                                DropDownTest.DataTextField = "Column1";
                                DropDownTest.DataValueField = "Column1";

                                DropDownTest.SelectedValue = SalesPerosnFullname;

                            if (UserLoginType() == 2)





                }//end of Ispost 

            catch (Exception PageErr)
                string ErrMessage="";
                ErrMessage ="Page Load -"+PageErr.Message.ToString()+"Source -"+ PageErr.Source.ToString() +"StackTrace -"+ PageErr.StackTrace.ToString();


Open in new window

Hope someone can show me where is the error or how to find the where is
Question by:ukerandi
LVL 36

Expert Comment

by:Miguel Oz
ID: 40269115
Please provide which line in Page_load  fails and the stack trace generated by the error.
LVL 52

Accepted Solution

Carl Tawn earned 2000 total points
ID: 40269730
Well the error is indicating an array indexing issue, so the first obvious line that could trip that would be:
string Test_SalesPagePath = "~/_layouts/Test_Global/Test_Sales.aspx?Hm=" + HomeBackGlobal[1];

Open in new window

But potentially any of your other function calls could have tripped it too, if they don't have any local exception handling at least.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question