0

Ok I have this Web Portal that is running for couple of months. The last time I accessed it remotely was like 3hrs ago and it is till working properly. Then when I accessed it again there is an error. So I tried to access it locally then it show this problem (below)

Stack Trace:  
[NullReferenceException: Object reference not set to an instance of an object.]
   MasterDataPortal.SiteMaster.Page_Load(Object sender, EventArgs e) in C:\Program Files\DataPortal_Final\MasterDataPortal\MasterDataPortal\Site.Master.cs:16
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
   System.Web.UI.Control.LoadRecursive() +70
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047  

In case you're wondering on whats in page_load{}
It's a Login Form. I also have a redirect control to login form if there no session supplied

John Saunders
  • 157,405
  • 24
  • 229
  • 388
zxc
  • 1,383
  • 3
  • 12
  • 30
  • Almost all cases of `NullReferenceException` are the same. Please see "[What is a NullReferenceException in .NET?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-in-net)" for some hints. – John Saunders Oct 13 '13 at 02:25

1 Answers1

1

The clue is in the error message:

C:\Program Files\DataPortal_Final\MasterDataPortal\MasterDataPortal\Site.Master.cs:16

If you open that file, go to line 16, around about there you will find what caused the NULL reference exception.

Of course, I'm assuming that you have access to the source code though. If not, then use something like .NET Reflector, or dotPeek, to open the DLL file where that code lives and take a look at the code that way.

Jason Evans
  • 28,042
  • 13
  • 88
  • 145
  • When I looked at the file it is not the login page. Now based on the code site.master.cs would only run after submitting credentials in the login.page of the site.. so I can't really think of a way on how to debug this program without messing the code.. can you pls give me further insights – zxc Oct 11 '13 at 08:24
  • There's nothing more I can suggest as such. In your position, I would be doing either a) Looking at the source code Site.Master.cs and try to work out what went wrong b) Use dotPeek (or any other reflection tool) to look at the code c) Use WinDbg to debug the problem. The last option being more powerful, but very advanced. – Jason Evans Oct 11 '13 at 08:29
  • I dont know why it happened but it seems when I run the application it run the class first instead of the Login.page form.. the clue you gave me answers so tnx mate! – zxc Oct 11 '13 at 08:32