zoukankan      html  css  js  c++  java
  • .net 模拟推送消息

    建立一份新的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);
                }
            }

  • 相关阅读:
    NOIP模拟测试7
    BigInt类
    bzoj 2733 [HNOI2012]永无乡 并查集+平衡树
    bzoj 2752 [HAOI2012]高速公路(road) 线段树
    bzoj 1584 Cleaning Up 打扫卫生 dp
    201709 半集训
    [SHOI2014]概率充电器 dp
    NOIP2016 天天爱跑步
    [HNOI2011] 数学作业
    [Poi2012]Festival
  • 原文地址:https://www.cnblogs.com/greywolf/p/2822777.html
Copyright © 2011-2022 走看看