Object reference not set to an instance of an object.

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 37:                             </a>
Line 38:                         </p>
Line 39:                         <% objImageDescription = SiteCache.GetGalleryImageDescription.SingleOrDefault(G => G.ImageNumber == Convert.ToInt32(ViewData["MainImageName"].ToString().Split('.')[0])); %>
Line 40:                         <% ImageAlternateText = objModel.ModelName + " " + ViewData["MainImageType"] + " Interior Picture"; %>
Line 41:                         <% ImageTitle = objModel.ModelName + " " + ViewData["MainImageType"] + " Interior Picture"; %>

Source File: d:\websites\carkhabari.com\wwwroot\Views\Common\interiorpictures.aspx    Line: 39

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.views_common_interiorpictures_aspx.<__RenderContent2>b__1(GalleryImageDescription G) in d:\websites\carkhabari.com\wwwroot\Views\Common\interiorpictures.aspx:39
   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source, Func`2 predicate) +172
   ASP.views_common_interiorpictures_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer) in d:\websites\carkhabari.com\wwwroot\Views\Common\interiorpictures.aspx:39
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   ASP.views_shared_sitenew_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\websites\carkhabari.com\wwwroot\Views\Shared\SiteNew.Master:149
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +55
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060


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