The Response property

The Response property of the CodeTemplate object returns a CodeTemplateWriter, which represents the template's output stream. Write to it from template code to insert your own output directly into the generated result:

<%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="This template demonstrates writing directly to the Response property" %>
<% RenderDirect(); %>
<script runat="template">
public void RenderDirect()
{
    Response.WriteLine("Written directly to the Response property.");
    Response.WriteLine("Hello " + System.Environment.UserName + "!");
}
</script>

Useful CodeTemplateWriter methods

Method What it does
Write Writes to the output without a line break.
WriteLine Writes to the output and adds a line break.
Indent Increases the indentation level of the output.
Unindent Decreases the indentation level of the output.
AddTextWriter Adds another output destination.