Question

I am wondering if anyone possibly has a solution to the problem I am facing with an asp website I have been asked to work on. However I do not have any experience with Microsoft .net framework.

The problem is as follows:

The websites front page does not load, but instead throws the following error:

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:

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.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] Incon.Default.Page_Load(Object sender, EventArgs e) +261
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

The rest of the pages does not have problem in loading at all and I am wasting a lot of time trying to figure out where the problem has come in.

Thanks in advance for any help.

Was it helpful?

Solution

From the code you have supplied (which is no code) it's very hard to pinpoint the exact cause of this. What can be said is that an object that you're trying to access is, for some reason, null.

The stacktrace indicates that it seems to be one of your usercontrols that you're probably trying to access around line 261 in the Page_Load method of code-behind file of the page.

Make sure your usercontrols have an ID and a runat="server" attribute and that you are able to access them from the code behind file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top