WEB上实现即使消息到达提醒
----------------------------〉
把这段代码放到一个iframe 里去,定时刷新

解决方案 »

  1.   

    一、把这段代码放到一个iframe 里去,定时刷新
    -----
    这是一种方法,但是该方法效率很低二、Application+Session+Cache
    -----
    这种方法怎么做,说来听听
      

  2.   

    看看无刷新聊天室的例子就明白了,设一个定时,然后会每隔一段时间去调web service的函数,这样就能实现了
      

  3.   

    ASP.NET结合XML做的无刷新聊天室
    http://aspxcn.com/dotnetdown/show.aspx?id=76
      

  4.   

    JS + WebService已经是最好的办法了,可以做到无刷新啊。
      

  5.   

    WEBService服务端代码: /// <summary>
    /// 获取最新的任务及送审件的提示信息
    /// </summary>
    //////////////////////////////////////////////////////////////////////////
    [WebMethod(EnableSession=true)]
    public string GetTipString()
    {
    i6.CRM.CLogin cc = new i6.CRM.CLogin();
    return cc.wf_getTipInfo();
    }客户端代码:
    //得到服务器的信息
    function loadMsg()
    {
    document.all["btnAlert"].click();
    var divERF  = document.all["divERFMsg"];
    divERF.useService("./ValidUsers.asmx?WSDL","Tips");
    var str = divERF.Tips.callService("GetTipString",divERF);
    //alert(str);
    }
    //定时刷新
    window.setInterval(loadMsg,60000);
    </script>
    //得到信息提示框内容
    <script language="javascript" event="onresult" for="divERFMsg">
    if(event.result.error)
    {
    var xfaultcode = event.result.errorDetail.code;
    var xfaultstring = event.result.errorDetail.string;
    alert(xfaultstring);
    return;
    }
    var str = event.result.value;
    if (str+"" !="undefined")
    {
    divERFMsg.innerHTML = str;
    }
    </script>其中divERFMsg是一个DIV控件,需要指定BEHAVIOR,如下: <DIV id="divERFMsg" style="Z-INDEX: 111; LEFT: 311px; BEHAVIOR: url(../Resource/inc/webservice.htc); WIDTH: 65%; POSITION: absolute; TOP: 135px; HEIGHT: 64px"
    runat="server">
    <P><FONT face="宋体"></FONT>&nbsp;</P>
    </DIV>
      

  6.   

    其实不管如何,你要还是要到服务器端去取消息,不能象window程序,开一个端口监听消息。
      

  7.   

    给你一个我做过的例子,可以参考一下:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <SCRIPT LANGUAGE="JavaScript">
    function Show()
    {
    iRefresh.document.write(Send("","TaskMsg.aspx"));
    iRefresh.document.close();
    setTimeout("Show()",5000);
    }
    //STR参数是传入的XML数据,你也可以传入其他文本数据.
    //不过这个函数需要服务器端处理之后返回XML数据,你也可以修改一下
    //URL参数表示你所要处理数据的文件地址
    function Send(Str,URL) 
    {
    var Http = new ActiveXObject("Microsoft.XMLHTTP"); //建立XMLHTTP对象
    Http.open("POST",URL,false);
    Http.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
    Http.send(Str); //开始发送数据
    var Back = Http.responsetext;
    delete(Http);
    return(Back); //函数返回数据
    }
    </SCRIPT>
    </head>
    <body leftmargin="0" topmargin="0">
    <iframe width="100%" height="100%" id="iRefresh" frameborder="no"></iframe>
    <script>Show();</script>
    </body>
    </html>
      

  8.   

    JS+WEB SERVICE,采用客户端脚本定期通过WS取服务器上数据,不用刷新。
      

  9.   

    应该就是客户端定期查询服务器了吧。
    http是不保存连接的
      

  10.   

    http://aspxcn.com/dotnetdown/show.aspx?id=76  这个为什么报如下错误?
    ___________
    System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.IO.FileNotFoundException: 找不到文件或程序集名称“em-sn1fk.dll”,或找不到它的一个依赖项。
    文件名:“em-sn1fk.dll”
       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
       at System.Xml.Serialization.Compiler.Compile()
       at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings)
       at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings)
       at System.Web.Services.Protocols.SoapServerType..ctor(Type type)
       at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
       at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)Fusion log follows: 
    === Pre-bind state information ===
    LOG: Where-ref bind. Location = C:\WINNT\TEMP\em-sn1fk.dll
    LOG: Appbase = file:///L:/web_site/AyloChat
    LOG: Initial PrivatePath = bin
    Calling assembly : (Unknown).
    ===LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/WINNT/TEMP/em-sn1fk.dll.   --- 内部异常堆栈跟踪的结尾 ---
    ___________
      

  11.   

    无刷新聊天室要用到xmlhttp啊
    不知道怎么实现%…………………………
    怎么调用那个xmlhttp对象啊
      

  12.   

    aspnet不可以创建对象啊,Microsoft.XMLHTTP怎么创建啊
      

  13.   

    Application+Session+Cache能实现无刷新???