Export (0) Print
Expand All

HttpResponse.Output Property

Enables output of text to the outgoing HTTP response stream.

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

public TextWriter Output { get; }
/** @property */
public TextWriter get_Output ()

public function get Output () : TextWriter

Property Value

A TextWriter object enabling custom output to the client.

The following code 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 htm HtmlEncode method to HTML encode it, and the Output property to display the encoded string to the page.

<%@ Page Language="C#" %>
<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.
    void btnSubmit_Click(object sender, EventArgs e) {

        if (IsPostBack)
        {
            Server.HtmlEncode(txtSubmitString.Text, Response.Output);
        }
    }

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <p>
            <font face="Tahoma" size="2">Enter your comments here:</font>
        </p>
        <p>
            <asp:TextBox id="txtSubmitString" runat="server" Width="181px" TextMode="MultiLine"></asp:TextBox>
        </p>
        <p>
            <asp:Button id="btnSubmit" onclick="btnSubmit_Click" runat="server" Text="Submit"></asp:Button>
        </p>
        <p>
            <asp:Label id="lblEncodedString" runat="server"></asp:Label>
        </p>
    </form>
</body>
</html>


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft