Server Error in '/' Application.

Index was outside the bounds of the array.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 26:             {
Line 27:                 command.Parameters.AddWithValue("@userId", user.ID);
Line 28:                 command.Parameters.AddWithValue("@languageId", new Guid(pathItems[0].ID));
Line 29:                 command.Parameters.AddWithValue("@selectedMenuId", new Guid(pathItems.Last().ID));
Line 30:                 command.Parameters.AddWithValue("@seperator", seperator);

Source File: d:\web\danskangus.dk\www\App_Code\Navigation\Menu.cs    Line: 28

Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   Navigation.Menu.GetMenu(User user, Page[] pathItems, String seperator) in d:\web\danskangus.dk\www\App_Code\Navigation\Menu.cs:28
   UserControls_Frontend_SubMenuV2.FillItems(Page[] pathItems) in d:\web\danskangus.dk\www\UserControls\Frontend\MobileMenu.ascx.cs:27
   _Default.Page_Load(Object sender, EventArgs e) in d:\web\danskangus.dk\www\Default.aspx.cs:225
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1602


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9214.0