Name

Output

Synopsis

TextWriter = Response.Output

Returns a write-only TextWriter object that can be used to write text directly to the output stream of the current response.

Parameters

TextWriter

An Object variable of type TextWriter. The TextWriter class includes the following members:

Member

Description

Close method

Closes the text writer and releases its resources.

Flush method

Clears the text writer’s buffer and writes output to its underlying device.

NewLine property

Gets or sets the new line character(s) used by the TextWriter object.

Write method

Writes data to the text stream.

WriteLine method

Writes data followed by a newline character to the text stream. The NewLine property defines the newline character.

Example

The example declares a local variable of type TextWriter, retrieves an instance of TextWriter from the Output property, and then uses the WriteLine method to write the text “Hello, World!” to the output stream. The WriteLine method writes the specified text (or text representation of nonstring data types), along with a line terminator, specified by setting the NewLine property of the TextWriter. Without setting the NewLine property, the line terminator would affect the formatting of the text sent to the browser. However, it would not alter the formatting of the output as rendered by the browser, since browsers typically ignore whitespace such as non-HTML line terminators when rendering HTML.

Sub Page_Load( ) Dim myWriter As System.IO.TextWriter ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.