Click here to Skip to main content
15,939,065 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I got a pretty big ajax problem at work. I hope someone can help on this this. (Sorry, I didn't bring the c# code home)

I got this one control that does a excel import (which can be time consuming) of a uploaded file.

I wrote a ajax script that calls a aspx page on a timer for a specific line number, that gets the current processed line of the excel sheet (don't ask, this was the way they wanted it) and updates on the clients pc and show a actual real time percentage (every x seconds).

I got it working successfully (the ajax script, tested) but the problem is when the excel command executes (on firebug) it causes a delay (usually 2 minutes) of all other java execute commands (which you can see pilling on firebug and there busy signals are turning).

Now, what I suspect (after loads of hours) is that all the other java threads have fired but because they use the ajax wait for success command, they don't get completed/send on the client's pc and is still waiting for a response from the server.

Any suggestions?
ZurdoDev 24-Apr-14 13:49pm    
You should post your relevant code. Are you saying this only does not work in FireFox?

I have seen that if you have EnableSession=true on your WebMethod, at least in IE, it still will not be asynchronous.
Serenity1 24-Apr-14 13:52pm    
Tried it on opera, chrome, firefox and Ie 9
ZurdoDev 24-Apr-14 13:53pm    
And they all fail? You'll want to post your code then.
Serenity1 24-Apr-14 13:55pm    
Got the code now,
//Call back page WebForm1.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IndyIIOrga.UserControls
public partial class WebForm1 : System.Web.UI.Page
public string sessionUserCID { get { if ( Session[ "UserCID" ] != null ) { return Session[ "UserCID" ].ToString() ?? "-1"; } else { return "-1"; } } set { Session[ "UserCID" ] = value; } }

protected void Page_Load( object sender, EventArgs e )
Random r = new Random();
//lblTesting.Text = string.Format( "{0}", cookieUserCID.ToString() );
lblTesting.Text = string.Format( "Indy is processing excel Line number {0}", sessionUserCID );


//Java that call the call back page
function SessionGetCookie()
url: "../../UserControls/WebForm1.aspx",
type: 'post',
dataType: 'text',
cache: false,
success: function (data, textStatus, xhr)
$.cookie('UserCID', $( data ).text() );


//Code that loops to update the label
var sessionTimeoutWarning = 1; //1 minute
var sessionTimeout = 18;
var sTimeout = parseInt(sessionTimeoutWarning) * 10 * 1000; //Regular time is meant *60*100
setTimeout('SessionWarning()', sTimeout); //Java timer function

function SessionWarning()
$("#lblPosition9162wa").text( $.cookie('UserCID') );
setTimeout('SessionWarning()', sTimeout);


//Label on client machine
<asp:Label ID="lblPosition9162wa" ClientIDMode="Static" runat="server" Text="9999" >
Serenity1 24-Apr-14 14:01pm    
No, they all successfully pass but are delayed when the big process starts (the excel import)
Edit. reply to previous q.
And they all fail? You'll want to post your code then.

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900