Server Error in '/' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 11:         <span class="subtext block mb-2"><em>Select the brands you would like to add to your dashboard</em></span>
Line 12: 
Line 13:         @foreach (var site in (List<Site>)ViewBag.Sites)
Line 14:         {
Line 15:             if (((List<string>)ViewBag.DashboardSiteCodes).Any(c => c == site.WebCode))

Source File: \\garpub.com\GBMWebFS\Prod\GCMS-Shared\Manage\dashboard\widgets\BrandSelector.cshtml    Line: 13

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_views_manage_dashboard_widgets_BrandSelector_cshtml.Execute() in \\garpub.com\GBMWebFS\Prod\GCMS-Shared\Manage\dashboard\widgets\BrandSelector.cshtml:13
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +251
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +121
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +135
   ASP.<>c__DisplayClass45_0.<__Render__control1>b__0() in \\garpub.com\GBMWebFS\Prod\GCMS-Shared\Manage\ManagementBootstrap.master:618
   Kendo.Mvc.UI.HtmlElement.WriteTo(TextWriter output) +168
   Kendo.Mvc.UI.Window.WriteHtml(HtmlTextWriter writer) +73
   Kendo.Mvc.UI.WidgetBase.Render() +99
   Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.Render() +14
   ASP.views_manage_managementbootstrap_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in \\garpub.com\GBMWebFS\Prod\GCMS-Shared\Manage\ManagementBootstrap.master:611
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +275
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +168
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +74
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4238


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