复制代码 代码如下:
<%@ 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();//异步执行
}
}
新闻热点
疑难解答
图片精选