HttpResponse.Output Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables output of text to the outgoing HTTP response stream.
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
Property Value
A TextWriter object that enables custom output to the client.
Examples
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="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>
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기