Issue with Inline Progress Bar and AJAX Request performance

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with Inline Progress Bar and AJAX Request performance

alvin

Hi,

We used Demo.aspx as a starting point to plug-in an upload file feature in our Web application.  Demo.aspx

is launched using "window.open" from our main web app. 

Issue 1.)  Without modification it performs uploads repeatedly with the exception of an occassional

issue with not displaying the inline progress bar.  The popup progress bar has no known issues.

Issue 2.)  We added modifications to move the file to a temporary directory that has wide open security

priviledges.  Once the file is moved we call a javascript routine in the main web app using "Page.RegisterStartupScript",

passing the file name, this routine submits an AJAX request (prototype.js Ajax.Request) then returns back to

Demo.aspx.  Demo.aspx's progress bar displays completion.  With this design, we thought that the progress bar

would not be held up but for some reason it takes an extended period of time for the AJAX request to be sent (not processed).

If we comment out the AJAX request the progress bar (upload process) performs as intended.

 

Any help would be greatly appreciated.

Thanks,

Al

Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

Dean Brettle
Administrator
I'm having a hard time following.  Can you email me (dean at brettle dot com) a small test project that has the issues you describe?

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

alvin
Thanks Dean, an email has been sent
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

alvin

In the zip that was emailed Web.config setting

<location path="UploadTest.aspx"> should be <location path="Demo.aspx">

was modified in error

Thanks,

Al

 

Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

Dean Brettle
Administrator
I haven't tried running the test project yet, but I did look at it and noticed you have:

            Page.RegisterStartupScript("UploadDocumentEx","<Script> LANGUAGE=\"JavaScript\">window.opener.uploadDocumentEx('"+strFileName+"', '"+strDocTitle+"');</Script>");

But that should be:

            Page.RegisterStartupScript("UploadDocumentEx","<Script LANGUAGE=\"JavaScript\">window.opener.uploadDocumentEx('"+strFileName+"', '"+strDocTitle+"');</Script>");

I would expect the extra angle bracket to cause a JS error which would cause the AJAX request to not be sent.  Does fixing that resolve the issues?
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

alvin

Dean,

Thanks for reviewing and providing input, actually works (submits AJAX request) without your update.  I think

that my format is ok, no JS error.  See comparison below...

<script language="JavaScript" type="text/javascript">...<script>

<script> language="JavaScript" type="text/javascript">...<script>

Made sure that the sample ran prior to sending it to you.

Thanks,

Al

Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

Dean Brettle
Administrator
I tried your test app and it works as I would expect.  I put a breakpoint in refreshFuncUploadDocumentEx() and it gets hit immediately after the upload finishes, with either an inline or popup ProgressBar.  Are you saying you see some sort of delay between when the upload finishes and when refreshFuncUploadDocumentEx() is called?  I'm not seeing a delay with NeatUpload-1.3.22, IE8, and the Visual Web Developer 2008 Express  development webserver, all running on Vista.  Are you using a different environment?  How long is the delay?

Also, in your original post you mention that the inline progress bar sometimes doesn't display.  You are probably seeing that occur with uploads that are very short.  Demo.aspx puts the inline progress bar in a <div style="display: none"> when the page loads, and then uses script to change the style to "display: block" when the upload starts.  For short uploads, the page loads again (with the hidden progress bar) so quickly that you never see the original progress bar.  If you don't like that behavior, you can remove the "display: none" on the div surrounding the ProgressBar control.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

Guest-1123

Thanks again...

The difference between my application and the test app that was sent to you is that it

takes longer to return to refreshFuncUploadDocumentEx (the file is being stored in

our system).  refreshFuncUploadDocumentEx is called when the process completes. 

During testing based on the file sizes used, it took up to 15 seconds to complete,

to call refreshFuncUploadDocumentEx.  So maybe adding a Thread.Sleep(15000) in

the sample would help to reproduce the problem.  (emailed the updated module to

you "").

 

My environment is very similar to yours, big difference Visual Studio NET 2003 and

WindowsXP.  I expected the progress bar to go away directly after the AJAX call

was submitted, but, it looked like it was still processing 10 - 15 seconds aftewards.

 

The idea was to upload the file via NeatUpload, move the file to our temp area,

submit and AJAX (async) request to our web server component to store the file in

our system, return immediately to NeatUpload control, expecting it to show completion,

but the progress bar seems to indicate that some work is still occurring. 

 

Hope that my comments are not confusing...

 

Thanks,

Alvin

 

Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

Dean Brettle
Administrator
Now I understand and have been able to reproduce the issue.

The problem is that UploadTest.aspx holds a read/write lock on the session state for the entire time it is running and NeatUpload's Progress.aspx tries to grab the session state as well because that is where it gets the upload state under some circumstances.

In general its a bad idea to have a long-running page hold a read/write lock on the session state.  Any other page in your app that doesn't have EnableSessionState="False" will also be blocked while UploadTest.aspx is running.  The fix is to add EnableSessionState="ReadOnly" to the <@Page> directive of UploadTest.aspx.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

alvin

Great thanks, will give it a try, your help is much appreciated...

Thanks,

Al

Reply | Threaded
Open this post in threaded view
|

Re: Issue with Inline Progress Bar and AJAX Request performance

alvin

Hi Dean,

Wanted to let you know that your suggestion worked well, and also made the following changes:

- UploadTest.aspx used to call a routine in main parent window .aspx and in that routine an AJAX request was submitted to yet another .aspx.  This

process was changed to submit the AJAX request directly from UploadTest.aspx.  Parent window was probably the main cause of session state hold up.

- Converted .aspx that handled AJAX request to .ashx HTTP handler to eliminate overhead

Thanks very much for your support

Al