`
justdoithz
  • 浏览: 48863 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论

HttpResponse..::.Output 属性

阅读更多
C#
public TextWriter Output { get; }

属性值

类型:System.IO..::.TextWriter

支持到客户端的自定义输出的 TextWriter 对象。

<!---->

下面的示例是一个包含 TextBox 控件的 ASP.NET 页,该控件的 TextMode 属性设置为 MultiLine。该页的代码接受用户在 TextMode 中输入的文本,然后使用 HtmlEncode()()() 方法对这些文本进行 HTML 编码,再使用 Output 属性将编码后的字符串显示到该页中。

<%@ 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  >
<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>

分享到:
评论

相关推荐

    stackerjs-http

    httpResponse . setContent ( { status : true } ) ; httpResponse . setContent ( "Everything is ok" ) ; // or httpResponse . setContent ( new Buffer ( "Something" ) ) ; // or httpResponse . setStatusCode...

    python 零基础学习篇python课程django框架django请求和响应16 HttpResponse .mp4

    python 零基础学习篇

    Android 创建HttpPost对象 获取HTTP连接.rar

      if(httpResponse.getStatusLine().getStatusCode()==200){//连接成功   String result = EntityUtils.toString(httpResponse.getEntity());//获得资源   result = result.replaceAll("\r\n|\n\r|\r|\n", "");...

    org.apache.http源代码和jar包

    import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache....

    HttpResponse的Output与OutputStream、Filter关系与区别介绍

    在网上经常看见有这样的代码HttpResponse response = HttpContext.Current.Response;现在我也来说说这几个东东是什么吧

    Android应用开发实验指导书.doc

    配置JDK: XP:右键"我的电脑"("属性"("高级"("环境变量" WIN7:右键"我的电脑"("高级系统设置"("环境变量" 新建系统变量: JAVA_HOME,C:\Program Files (x86)\Java\jdk1.6.0_18(JDK安装目录)。 PATH,%JAVA_...

    import org.apache.http

    import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache....

    org.apache.http 相关的jar包

    import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache....

    Django实现跨域的2种方法

    return HttpResponse('%s("我要上鸭王")' %(callback,)); # javascript function submitJsonp4() { $.ajax({ url: 'http://127.0.0.1:9000/xiaokai.html', type: 'GET', //写post 没有用 只能发get dataType: ...

    Python实现简单http服务器

    1.浏览器中输入网站地址:172.20.52.163:20014 ...代码实现 server.py #!/usr/bin/python ...def HttpResponse(header,whtml): f = file&#40;whtml&#41; contxtlist = f.readlines() context = ''

    python实现简单http服务器功能

    背景 ...1.浏览器中输入网站地址:172.20.52.163:20014 ...代码实现 server.py #!/usr/bin/python ...def HttpResponse(header,whtml): f = file&#40;whtml&#41; contxtlist = f.readlines() context = ''.

    is-ok:检查 HTTP 响应是否成功

    接受的响应对象,具有statusCode属性,第一参数,并返回true ,如果状态码是内2xx范围,否则返回false 。 可选地,它将回调作为第二个参数,仅当响应不成功时才使用错误对象调用它。 错误设置了statusCode 、 ...

    chilkat-9.5.0-库+注册机

    HttpResponse Imap JavaKeyStore JsonArray JsonObject Jwe Jws Jwt KeyContainer Log MailMan Mailboxes MessageSet Mht Mime Ntlm OAuth1 OAuth2 Pem Pfx PrivateKey Prng PublicKey Rest Rsa Rss SFtp SFtpDir ...

    http依赖jar包.zip

    import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.ParseException; import org.apache.http.client.ClientProtocolException; import org.apache....

    org.apache.http.httpentity jar包-系列jar包

    import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache....

    Cookie的使用

    在Cookie介绍中 我们了解到Cookie是基于Set Cookie响应头和Cookie请求头工作的 服务器通过response对象的addHeader 方法将cookie发送给浏览器 然后浏览器通过Cookie请求头将cookie再送回服务器

    node.js中的http.response.end方法使用说明

    方法说明: 结束响应,告诉客户端所有消息已经发送。当所有要返回的内容发送完毕时,该函数必须被调用一次。 如何不调用该函数,客户端将永远处于等待状态。 语法: 代码如下: response.end([data], [encoding]) ...

    新浪微博授权代码及测试结果.zip

    String strResult = EntityUtils.toString(httpResponse.getEntity()); Log.e("WeiboKu", "strResult :"+strResult); return strResult; } else { Log.e("WeiboKu", "strResult Error:"+statusCode); return...

Global site tag (gtag.js) - Google Analytics