title: C# in Page_Load puts code on top of <html>
body: <p>More specifically, I have made a small webpage using <code>C#</code> and a <code>.aspx</code> document. All <code>C#</code> code I have put in the <code>&lt;head&gt;</code> part of my document, inside <code>Page_Load</code> like this:</p>
  
  <pre><code>&lt;script language="C#" runat="server"&gt;
  protected void Page_Load(Object s, EventArgs e) {  
       Response.Write(@"&lt;div class=""header""&gt;Foo Bar&lt;/div&gt;");
       ...
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>This works somehow, but the problem is that the html generated by this gets stuffed on top of the beginning <code>&lt;html&gt;</code> tag in the document which results in a broken character setting (doesn't read the meta tag?) and strange things not supposed to happen. I'm new to using <code>ASP.NET</code> and it's obvious. Where would I put all my statements so that they would be reachable from the <code>&lt;body&gt;</code> using <code>&lt;%</code> delimiters?</p>