System.NullReferenceException: Object reference not set to an instance of an object.

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.

I have an app that usually works but sometimes tosses this error. I _think i have it narrowed down to the first page hit after an IIS restart...since this is on a production server I can't try again until tonight.

Can anyone read / interprete the error output to shed any light on what's going wrong.

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.]
   compliance4.loginGW.Page_Load(Object sender, EventArgs e)
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do this happen when you load the page, or after an event is fired.

Could be a few things. I would start with the your controls. Are you referencing a control in you behind code that isn't on your page, Check the spelling of the controls ID field corresponds with your behind code controls as well.

have fun.

This error means you are attempting to use a object that hasn't been instantiated and as such is a very general error as it could be anywhere.

As you say you think this happens after an IIS restart, perhaps you are storing an object in the session that is cleared out by the restart. Then the next time you attempt to use that session object, it will cause this exception as it's no longer there.
Dim SessionObject As MyObject
SessionObject.PropertyName = "Test"
Session("Object") = SessionObject


CType(Session("Object"), MyObject).PropertyName = "Something new"

You can get round this by checking if the object is there:
If Not Session("Object") Is Nothing Then
    CType(Session("Object"), MyObject).PropertyName = "Something new"
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
may be some where in code you didnt initialize any variables.....
this error commes
check your code...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.