Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi All,

While am trying to access my web page following error occurred. I dont know why this error happened here. All replies are welcome.

Server Error in '/PreProcess' 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: 


 The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

   <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
    <system.web>
        <compilation debug="true"/>
    </system.web>
</configuration>

 Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  

Stack Trace: 



[NullReferenceException: Object reference not set to an instance of an object.]
   Suncor.Framework.UI.BasePage.get_MessagePanelMasterProperty() in D:\Refining_and_Marketing\Utilities\RMWebTkt.net\trunk\Code\ApplicationSource\RMWebTkt.Net4\Framework\Suncor.Framework.UI\BasePage.cs:242
   Suncor.Framework.UI.BasePage.get_MessagePanel() in D:\Refining_and_Marketing\Utilities\RMWebTkt.net\trunk\Code\ApplicationSource\RMWebTkt.Net4\Framework\Suncor.Framework.UI\BasePage.cs:249
   Suncor.Framework.UI.BasePage.AddBulletedMessage(String message, Object[] args) in D:\Refining_and_Marketing\Utilities\RMWebTkt.net\trunk\Code\ApplicationSource\RMWebTkt.Net4\Framework\Suncor.Framework.UI\BasePage.cs:278
   Suncor.Framework.UI.BasePage.AddErrorMessage(String message, Object[] args) in D:\Refining_and_Marketing\Utilities\RMWebTkt.net\trunk\Code\ApplicationSource\RMWebTkt.Net4\Framework\Suncor.Framework.UI\BasePage.cs:289
   Suncor.Framework.UI.BasePage.OnError(EventArgs e) in D:\Refining_and_Marketing\Utilities\RMWebTkt.net\trunk\Code\ApplicationSource\RMWebTkt.Net4\Framework\Suncor.Framework.UI\BasePage.cs:414
   System.Web.UI.Page.HandleError(Exception e) +86
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8422
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
   System.Web.UI.Page.ProcessRequest() +78
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.cardordering_monerisreceiptproxy_aspx.ProcessRequest(HttpContext context) +4
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



Thanks,
DK

What I have tried:

Change compilation mode in web cofig.
Posted
Updated 24-May-17 5:13am
Comments
F-ES Sitecore 24-May-17 10:25am    
This question is asked several times a day. Please google the error message before posting a question.
Dhineshkumar Velmayil 24-May-17 10:30am    
can you please send the ans link for the question. Me too tried.
But most of the people facing MAC failed issue. But in my scenario no MAC failed alert. Thats why posting here my dear friend.
F-ES Sitecore 24-May-17 10:36am    
We can't access your code or run your site so there is nothing we can do, you'll need to use the debugger to track down exactly what is causing the error. From the stack trace something in the "get" for MessagePanelMasterProperty in your base page. It is probably accessing a control and using it before checking it exists, but that's just a guess.
Dhineshkumar Velmayil 24-May-17 10:40am    
Thanks for your reply. My code is locally working very fine. But when we move to server this issue is occured. (only dll are move to server). Anyway thanks again.

DK

1 solution

This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.

Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterdays shirt when you took it off last night.

We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!

Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, VS will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, VS will stop before the error, and let you examine what is going on by stepping through the code looking at your values.
If this only occurs in production, then you need to start logging instead - adding code to output the status of variables to a file for subsequent perusal - to find out what is null, and why.

But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900