Back to Blog

Your Own “Servlet” or HTML Spew Machine

by MrPhil
blog

So you want a quick way to spew your own html?

Create an aspx page and remove all the html and then in the code behind replace the Page_Load procedure with:

private void Page_Load(object sender, System.EventArgs e)
{
    Response.Clear();
    Response.ClearHeaders();
    Response.ContentType = "Text/HTML";
    Response.AppendHeader( "your header", "your value" );
    Response.Write( "Your spew" );
}

Of course you don't have to spew html.