復制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="response.aspx.cs" Inherits="_Default" Async="true" AsyncTimeout="30" EnableSessionState="False"%>
if (Request.Form.Count>0)
{
if (Request.Form["type"] == "loop")
{
ChatTask task = new ChatTask(this.Context);
task._chatNow = this.ChatNow;//有新的消息的回調方法,即為通知處理,這個時候釋放掉連接
string user = Request.Form["user"].Trim();
PageAsyncTask async = new PageAsyncTask(new BeginEventHandler(task.OnBegin), new EndEventHandler(task.OnEnd), new EndEventHandler(task.OnTimeout), user);
Page.RegisterAsyncTask(async);
Page.ExecuteRegisteredAsyncTasks();//異步執行
}
}
新聞熱點
疑難解答
圖片精選