Server Error in '/' Application. Ok if refresh
<p>I have a problem when running a web application. The error is as shown below:</p>

<blockquote>
  <p>Server Error in '/' Application.</p>
  
  <p>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. </p>
  
  <p>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.</p>
  
  <p>Source Error: </p>
  
  <p>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:</p>
  
  <ol>
  <li><p>Add a "Debug=true" directive at the top of the file that generated the error. Example:</p>

<pre><code>&lt;%@ Page Language="C#" Debug="true" %&gt;
</code></pre>
  
  <p>or:</p></li>
  <li><p>Add the following section to the configuration file of your application:</p>

<pre><code>&lt;configuration&gt;
    &lt;system.web&gt;
        &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
&lt;/configuration&gt;
</code></pre></li>
  </ol>
  
  <p>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.</p>
  
  <p>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.  </p>
  
  <p>Stack Trace: </p>

<pre><code>[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.me_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) +78
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +114
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +239
   System.Web.UI.Page.Render(HtmlTextWriter writer) +37
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4239
</code></pre>
</blockquote>

<p>The problem is that this error only occurs sometimes and would be ok once we refresh the page. This problem is bugging me because it never happen when I debug the code. Only in the production server it happens. The only resolve is to refresh the page. But that is not an acceptable solution.</p>
