Output Property

HttpResponse.Output Property


Enables output of text to the outgoing HTTP response stream.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

Public Property Output As TextWriter

Property Value

Type: System.IO.TextWriter

A TextWriter object that enables custom output to the client.

The following example is an ASP.NET page that contains a TextBox control that has its TextMode property set to MultiLine. The page's code takes the text that a user enters in the TextMode, uses the HtmlEncode method to HTML encode it, and the Output property to display the encoded string to the page.

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">

    ' When the page is posted back, the text box's 
    ' Text property value is HTML encoded and sent
    ' sent to the current response.
    Private Sub btnSubmit_Click(sender As Object, e As EventArgs)
        If (IsPostBack = True)
            Server.HtmlEncode(txtSubmitString.Text, Response.Output)
        End If
    End Sub

<html xmlns="http://www.w3.org/1999/xhtml" >
    <title>ASP.NET Example</title>
    <form id="form1" runat="server">
        <p style="font-family:Tahoma; font-size:12">
            Enter your comments here:
            <asp:TextBox id="txtSubmitString" runat="server" Width="181px" TextMode="MultiLine"></asp:TextBox>
            <asp:Button id="btnSubmit" onclick="btnSubmit_Click" runat="server" Text="Submit"></asp:Button>
            <asp:Label id="lblEncodedString" runat="server"></asp:Label>


.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft