首页 > Web开发 > 详细

如何使用ASP.NET开发基于推技术的聊天室?

时间:2014-12-19 18:40:07      阅读:221      评论:0      收藏:0      [点我收藏+]

public class Content : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Session.Timeout = 60;
Response.Write("欢迎 . . .<br> ");
Response.Flush();
Application[Session.SessionID] = Response;
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}
}


// Send.aspx.cs //////////////////////////////////////////////////////////
public class Send : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button ButtonSend;
protected System.Web.UI.WebControls.TextBox TextBox1;

private void ButtonSend_Click(object sender, System.EventArgs e)
{
foreach(string name in Application.AllKeys)
{
HttpResponse Response = Application[name] as HttpResponse;
if(Response!=null && Response.IsClientConnected)
{
Response.Write(TextBox1.Text + "<br> ");
Response.Flush();
}
else
{
Application.Remove(name);
}
}
}
}

如何使用ASP.NET开发基于推技术的聊天室?

原文:http://www.cnblogs.com/ranran/p/4174475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!