当前位置:系统之家 > 技术开发教程 > 详细页面

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

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

更新时间:2022-05-10 文章作者:未知 信息来源:网络 阅读次数:

public class Content : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Session.Timeout = 60;
Response.Write("欢迎 . . .<br>\n");
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>\n");
Response.Flush();
}
else
{
Application.Remove(name);
}
}
}
}

温馨提示:喜欢本站的话,请收藏一下本站!

本类教程下载

系统下载排行