Object reference not set to an instance of an object

Discussion in 'ASP.NET / ASP.NET Core' started by zoey, Dec 28, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have hosted my site on DASP for almost 3 years now without any issues, and the site has been on auto-pilot for the last year or so...meaning that no real code changes have taken place except for minor cosmetic updates to page text.

    It seems that about a month or so ago, one (and only one) of my pages has been throwing a "NullReferenceException: Object reference not set to an instance of an object" error. I outsourced the code development, so I am at a loss as to why this error would spontaniously happen (as I mentioned, no one has touched the code in the last year).

    The page in question is an input or edit page where the User selects exam scores from drop down lists and punches in other values in input boxes. I have other such pages for other data points on my website, and they all work fine.

    Also, I do not recognize the directory "D:\Bhavani\" in the path before MYWEBSITE below. Is that some DASP directory that I can't see from the user side in my FTP client?

    I appreciate any guidance the forum can provide. Thank you.

    Code:
    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: 
    
    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.]
       MYWEBSITE.MemberExamScoreUpdate.Page_Load(Object sender, EventArgs e) in D:\Bhavani\MYWEBSITE\MemberExamScoreUpdate.aspx.cs:195
       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
     
  2. Update

    Update:

    I have a second account here at DASP that was used for development and testing purposes (it was the Staging version of my Live site before code was moved to the Live site). The Staging account had an older version of my database and worked fine while the Live site produced the error.

    The Staging site worked fine until I restored the Staging DB with a backup copy of the Live DB. This leads me to believe there is something wrong in the database that's causing the issue.

    Any speculations what went wrong in the DB and how do I fix it??

    Thanks again...
     
  3. Since I started this thread, I thought I'd post back with my findings to help anyone that might encounter a similiar issue.

    RESOLVED: the cause of my issue had something to do with the drop down menus being populated by values stored in a table in the DB, and that table had a bad value that couldn't be loaded by the web page. Correcting the data corrected my issue.
     
  4. mjp

    mjp

    Thanks for the follow-up! Glad it's worked out.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page