Re: Session Ends Prior to Uploader completing

  •  10-11-2012, 10:20 AM

    Re: Session Ends Prior to Uploader completing

    Hi BenHolcombe,

     

    You can try the example below, it shows you how to keep activating the session in API "CuteWebUI_AjaxUploader_OnStop" and  "CuteWebUI_AjaxUploader_OnStart".

     

    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head runat="server">  
    6.     <title>example</title>  
    7. </head>  
    8. <body>  
    9.     <form id="form1" runat="server">  
    10.         <div class="content">  
    11.             Debug:  
    12.             <input type="text" readonly="readonly" id="output" style="width: 400px" />  
    13.             <p>  
    14.                  <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Browse Files"  
    15.                     InsertButtonID="BrowseButton">  
    16.                 </CuteWebUI:Uploader>  
    17.             </p>  
    18.   
    19.             <script type="text/javascript">  
    20.         var output=document.getElementById("output");  
    21.         var keepsessionurl="test.aspx";  
    22.           
    23.         var keeptimeout=180000; //2 mins  
    24.         var keeptimerid;  
    25.           
    26.         keeptimeout=3000;//6 sec for testing  
    27.           
    28.         function keeponce()  
    29.         {    
    30.             keeptimerid=setTimeout(keeponce,keeptimeout);  
    31.               
    32.             output.value="send request"  
    33.               
    34.             var xh=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");  
    35.             xh.open("GET",keepsessionurl,true);  
    36.             xh.onreadystatechange=function()  
    37.             {  
    38.                 if(xh.readyState<4)return;  
    39.                   
    40.                 output.value="recieved "+xh.status+" , "+new Date().getTime()  
    41.             }  
    42.             xh.send();  
    43.               
    44.         }  
    45.   
    46.         function CuteWebUI_AjaxUploader_OnStart()  
    47.         {  
    48.             output.value="start"  
    49.             clearTimeout(keeptimerid);  
    50.             keeptimerid=setTimeout(keeponce,keeptimeout);  
    51.         }  
    52.         function CuteWebUI_AjaxUploader_OnStop()  
    53.         {  
    54.             output.value="stop"  
    55.             clearTimeout(keeptimerid);  
    56.         }  
    57.   
    58.             </script>  
    59.   
    60.         </div>  
    61.     </form>  
    62. </body>  
    63. </html>  
     

    regards,

     

    Ken 

View Complete Thread