How to use ASP. NET to develop chat rooms based on push technology ?, Asp.net chat room
Public class Content: System. Web. UI. Page
{
Private void Page_Load (object sender, System. EventArgs e)
{
Session. Timeout = 60;
Response. Write ("Welcome... <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 );
}
}
}
}