다음을 통해 공유


HttpResponse.Output 속성

정의

나가는 HTTP 응답 스트림에 대한 텍스트 출력을 활성화합니다.

public:
 property System::IO::TextWriter ^ Output { System::IO::TextWriter ^ get(); };
public:
 property System::IO::TextWriter ^ Output { System::IO::TextWriter ^ get(); void set(System::IO::TextWriter ^ value); };
public System.IO.TextWriter Output { get; }
public System.IO.TextWriter Output { get; set; }
member this.Output : System.IO.TextWriter
member this.Output : System.IO.TextWriter with get, set
Public ReadOnly Property Output As TextWriter
Public Property Output As TextWriter

속성 값

TextWriter

클라이언트에 대한 사용자 지정 출력을 활성화하는 TextWriter 개체입니다.

예제

다음 예제는 해당 TextMode 속성MultiLine이 설정된 컨트롤을 포함하는 TextBox ASP.NET 페이지입니다. 페이지의 코드는 사용자가 입력TextMode하는 텍스트를 사용하고, 메서드를 사용하여 HTML로 인코딩하고Output, 인코딩된 문자열을 페이지에 표시하는 속성을 사용합니다HtmlEncode.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <p style="font-family:Tahoma; font-size:12">
            Enter your comments here:
        </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>

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <p style="font-family:Tahoma; font-size:12">
            Enter your comments here:
        </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>

적용 대상