专著于富媒体技术~
本站某些作品来源于互联网,如果侵犯了您的利益,请留言说明
建立一份新的aspx页面,在aspx.cs里的page_load里加上如下代码...然后保存,访问一下...就可以看到服务器推送模式的效果了...

        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "multipart/x-mixed-replace;boundary=--TempString--";
            HttpContext.Current.Response.StatusCode = 200;
            HttpContext.Current.Response.Write("");
            HttpContext.Current.Response.Write("--TempString--\r\n");
            HttpContext.Current.Response.Flush();
            while (HttpContext.Current.Response.IsClientConnected)
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Write("date : " + DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss") + "\r\n");
                HttpContext.Current.Response.Write("--TempString--\r\n");
                HttpContext.Current.Response.Flush();
                Thread.Sleep(1000);
            }
        }


            


作者:gdgzboy@牛C网
地址:http://www.niuc.net/post/4209/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!



磊磊
2009/09/10 14:00
浏览器一直在装入,CPU使用50%
nuonuo
2009/04/29 11:06
不行,要注意什么不~
gdgzboy 回复于 2009/04/29 22:43
什么都不需要注意
游戏
2009/03/14 15:51
服务器推送和长连接是两个概念吧~~~~感觉楼主有点偷梁换柱的意思哦~~~~
xuzhe
2009/01/11 23:43
客户端的ajax如何调用啊?弱弱得问一下。
gdgzboy 回复于 2009/02/08 15:50
ajax?推送代码跟ajax无关啊
gattaca
2008/09/19 13:45
試過了確實可行!
我現在把源碼放在xxx.ashx.cs中,
實現新聞跑馬燈效果.

感謝!!
CAI
2008/08/01 15:47
占资源好厉害啊
gdgzboy 回复于 2008/08/01 21:31
你只服务器?还是客户端
wangchengh
2008/07/25 14:39
测试过不行,ie会一直装入但是没有内容显示出来,cpu使用率达100%
gdgzboy 回复于 2008/07/25 21:34
我测试过可行啊
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写