title: HtmlTextWriter does not render
body: <p>I am using the HtmlTextWriter to create some HTML for me. I want to test if my page actually works but it doesnt render the div.</p>
  
  <p>using System;
  using System.Collections.Generic;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.IO;</p>
  
  <pre><code>public partial class web_content_notes_Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          /* Configuration Start */
          string thumb_directory = "img/thumbs";
          string orig_directory = "img/original";
          int stage_width = 600;
          int stage_height = 480;
          Random random = new Random();
  
          // array of allowed file type extensions
          string[] allowed_types = { "bmp", "gif", "png", "jpg", "jpeg", "doc", "xls" };
  
          /* Opening the thumbnail directory and looping through all the thumbs: */
          foreach (string file in Directory.GetFiles(thumb_directory))
          {
              string title = Path.GetFileNameWithoutExtension(file);
              if (allowed_types.Equals(Path.GetExtension(file)) == true)
              {
                  int left = random.Next(0, stage_width);
                  int top = random.Next(0, 400);
                  int rotation = random.Next(-40, -40);
  
                  if ((top &gt; stage_height - 130) &amp;&amp; (left &gt; stage_width - 230))
                  {
                      top -= 120 + 130;
                      left -= 230;
                  }
  
  
              }
  
              //display the files in the directory in a label for testing
              Label1.Text = (file);
  
              StringWriter stringWriter = new StringWriter();
  
              // Put HtmlTextWriter in using block because it needs to call Dispose.
              using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
  
                  // The important part:
                  writer.Write("&lt;div&gt;testing123&lt;/div&gt;");
  
          }
  
      }
  }
  </code></pre>
  
  <p>I want to add the various variables into the div.</p>
  
  <p>How do i do this? I remember in classic asp/vbscript you had to wrap the code in <code>&lt;% code %&gt;</code> not sure if this is the case in ASP.NET / C#</p>