title: How to render an asp.net WebForm page from Global.asax?
body: <p>for one reason or another I'm messing around with a "minimalistic" ASP.Net just for fun. I've disabled a lot of things and am attempting to reimplement things. One thing I can't quite figure out is how to render an ASP.Net page(aspx). </p>
  
  <p>This is my progress so far: </p>
  
  <pre><code>//global.asax
      protected virtual void Application_BeginRequest (Object sender, EventArgs e)
      {
          HtmlTextWriter writer=new HtmlTextWriter(Response.Output);
          if(Request.Url.AbsolutePath.Substring(0,Math.Min(Request.Url.AbsolutePath.Length,8))=="/static/"){
              return; //let it just serve the static files
          }else if(Request.Url.AbsolutePath=="/test1"){
              test1 o=new test1();
              o.ProcessRequest(Context);
              o.RenderControl(writer);
              writer.Flush();
              writer.Close();
              Response.Flush();
          //  Response.Write(writer.ToString());
  
          }else{
              Response.ContentType="text/plain";
              Response.Write("Hi world!");
          }
          CompleteRequest();
      }
  </code></pre>
  
  <p>the /static/ bit works as does the "hi world". I can't get the <code>/test1</code> route to work though. It reaches that point but all that is displayed is a black page. </p>
  
  <p>I have a test1.aspx page with this designer content:</p>
  
  <pre><code>&lt;%@ Page Language="C#" Inherits="namespace.test1" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;test1&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1"&gt; &lt;!--just testing if two forms works and such--&gt;
  
      &lt;/form&gt;
      &lt;form id="form2"&gt;
      &lt;input type="text" id="test1" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and it has almost no code behind(just an empty function which doesn't matter) </p>
  
  <p>What am I doing wrong here?</p>