日期:2014-05-16 浏览次数:20569 次
public class AsnyHandler:IHttpAsyncHandler,IRequiresSessionState { FullUserInfo fu; String txtTile; String freetext; String userid; String fileid; int chk=0; MailDal mailDal = new MailDal(); MessageSelDal md = new MessageSelDal(); public bool sc; public AsnyHandler() { } public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { //myAsynResult为实现了IAsyncResult接口的类,当不调用cb的回调函数时,该请求不会返回到给客户端,会一直处于连接状态 myAsynResult asyncResult = new myAsynResult(context, cb, extraData); String content =context.Request.Params["content"]; fu =context.Session[SharedNames.WEB_USER] as FullUserInfo; if (content == "6") { txtTile = context.Request.Params["txtTile"]; freetext = context.Request.Params["freetext"]; userid = context.Request.Params["userid"]; fileid = context.Request.Params["fileid"]; chk = Convert.ToInt32(context.Request.Params["chkType"]); sc=setMail(); } //向Message类中添加该消息 Messages.Instance().AddMessage(sc,content, asyncResult); return asyncResult; }