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 18:         PageID = UrlData[0].AsInt();
Line 19:         SEOPageID = db.QueryValue("SELECT TOP 1 TITLE FROM Category WHERE ID=@0 AND Live = 'Yes'", PageID);
Line 20:         Response.Redirect("~/Products/" + @SEOPageID.Replace(" ", "_").Replace("/", "(slash)").Replace("&", "(and)").Replace(".", "(dot)"));
Line 21:         if (PageID == 0)
Line 22:         {

Source File: d:\Websites\BatemanOgden\www\Products.cshtml    Line: 20

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_Products_cshtml.Execute() in d:\Websites\BatemanOgden\www\Products.cshtml:20
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +251
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +98
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +181
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +106
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +141


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