日期:2014-05-16  浏览次数:20569 次

jquery+asp.netcomet在ashx文件中调用session问题
C# code

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;
    }



上面的代码..在取session时候卡界面是怎么回事...??如果把实现接口去掉吧
fu =context.Session[SharedNames.WEB_USER] as FullUserInfo;
这句话去掉..页面特别流畅..

------解决方案--------------------
肯定是 数据量过大 异步调用 出现问题!!!