title: I don't understand the stack trace from a clients website. System.NullReferenceException: Object reference not set to an instance of an object
body: <p>The web application is asp mvc. I can't figure out what object reference not set to an instance of an object means. Is it database related or some ajax failing? I am not familiar with ASP MVC apps.
  And when I try to go to admin page, Index.apsx keeps getting injected in the wrong place in the url, what causes that?</p>
  
  <p>Server Error in '/' Application.</p>
  
  <p>Object reference not set to an instance of an object.</p>
  
  <p>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. </p>
  
  <p>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.</p>
  
  <p>Source Error: </p>
  
  <p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</p>
  
  <p>Stack Trace: </p>
  
  <pre><code>[NullReferenceException: Object reference not set to an instance of an object.]
  BoatingSafety.Utils.CreateContext() in C:\inetpub\wwwroot\AppDevProjects\ASP.NET\BoatingSafety\BoatingSafety\SupportClasses\Utils.cs:27
  BoatingSafety.Controllers.PageController.Index() in C:\inetpub\wwwroot\AppDevProjects\ASP.NET\BoatingSafety\BoatingSafety\Controllers\PageController.cs:31
  lambda_method(ExecutionScope , ControllerBase , Object[] ) +40
  System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
  System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
  System.Web.Mvc.&lt;&gt;c__DisplayClassd.&lt;InvokeActionMethodWithFilters&gt;b__a() +53
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258
  System.Web.Mvc.&lt;&gt;c__DisplayClassf.&lt;InvokeActionMethodWithFilters&gt;b__c() +20
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +193
  System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +300
  System.Web.Mvc.Controller.ExecuteCore() +104
  System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +36
  System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
  System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +59
  System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +54
  System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
  System.Web.Mvc.MvcHttpHandler.VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext) +54
  System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext) +111
  System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext) +40
  System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +7
  BoatingSafety._Default.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\AppDevProjects\ASP.NET\BoatingSafety\BoatingSafety\Default.aspx.cs:22
  System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
  System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
  System.Web.UI.Control.OnLoad(EventArgs e) +99
  System.Web.UI.Control.LoadRecursive() +50
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
  </code></pre>