Runtime error appeared after I moved some code to new class
<p>I had the code:</p>

<pre><code>namespace ShowDiagram1
{
    public partial class WebForm1 : System.Web.UI.Page
   {
         bitmap.Save(Server.MapPath("pic1.jpg"), ImageFormat.Jpeg);
        Image1.ImageUrl = this.ResolveUrl("pic1.jpg");
    }
}
</code></pre>

<p>It worked okay.
I moved this code to new class</p>

<pre><code> namespace ShowDiagram1
 {
     public class MyDraw : WebForm1
     {
          ...
         bitmap.Save(Server.MapPath("pic1.jpg"), ImageFormat.Jpeg);
        Image1.ImageUrl = this.ResolveUrl("pic1.jpg");
     }
 }
</code></pre>

<p>Now I have runtime error</p>

<blockquote>
  <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>Line 85: Image1.ImageUrl = ResolveUrl("pic1.jpg");</p>
</blockquote>

<p>pic1.jpg was created okay.</p>

<p>Thanks.</p>
