0

I'm facing the following issue: I have a C# asp.net file upload form with a submit button. After the form is submitted the file is uploaded and post-processing is started. The point is that the post-processing can take up to several minutes.

I would like to create some kind of asynchronous call of the post-processing function with showing information to the user.

So, the steps should be:

  1. file form is submitted by user and upload is started
  2. after the file is uploaded some information is shown to the user (e.g. "Processing..." or some loading-bar animation, etc.)
  3. Meanwhile, the post-processing function is automatically started running in a background
  4. After the post-processing function is finished the user is automatically redirected to another page

When i was searching the Internet I've found several examples but mostly only about asynchrounous call of functions, asynchrounous file upload (PageAsync method, etc.).

Any idea or techniques I should use or some tutorial? Thanks in advance

Martin Buberl
  • 45,844
  • 25
  • 100
  • 144
Frankie
  • 1
  • 1
  • The resources you found does not provide any useful idea to you? – Furqan Hameedi Mar 10 '11 at 10:11
  • You can try with AJAX and JQuery. This can provide you asynchrounous call to a particular function when the button is clicked and would return the status back the function. Check link: http://stackoverflow.com/questions/1060539/parallel-asynchronous-ajax-requests-using-jquery – Shivkant Mar 10 '11 at 10:21

4 Answers4

0

That all depends on how fancy you want to get;

  1. Meta-refresh that reloads the page until the background operation is finished
  2. Some kind of ajax call that checks some resource for when the processing is done
  3. HTML5 websockets. if supported, which it probably isn't.

Personally I would use the number 2. and use jQuery to poll the upload page every 500ms or something.

ullmark
  • 2,469
  • 1
  • 19
  • 28
0

You can use AJAX

http://geekswithblogs.net/ranganh/archive/2008/04/01/file-upload-in-updatepanel-asp.net-ajax.aspx

http://vinayakshrestha.wordpress.com/2007/03/13/uploading-files-using-aspnet-ajax-extensions/

http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=upload+using+Ajax&qscrl=1#sclient=psy&hl=en&qscrl=1&source=hp&q=upload+using+Ajax+in+asp.net&aq=f&aqi=&aql=&oq=&pbx=1&fp=db9c4fafd449a821

scorpio
  • 1,587
  • 2
  • 15
  • 27
  • Ye, definitely I will use AJAX but the problem is not that much about file uploading (the file will be always very small < 100kB and only on the intranet, which means uploading will be very fast). The problem I'm trying to figure out is how to upload file and start asynchrounously some function after the uploading is finished, and show information back to the page. – Frankie Mar 10 '11 at 10:34
  • http://geekswithblogs.net/ranganh/archive/2009/10/01/fileupload-in-updatepanel-asp.net-like-gmail.aspx. if you notice in this example.. there is a message shown to user when upload is complete...you can redirect user or insert and run any javascript by using placeholders control – scorpio Mar 10 '11 at 11:11
0

The jquery/flash control uploadify will allow you to do this easily. They also provide a method for asynchronously calling a method on the event that the file upload completes as described in this comprehensive documentation.

Sean Hunter
  • 1,041
  • 8
  • 19
  • It must be pure C#/javascript/Ajax Control Toolkit solution...Flash,Silverlight and other "advanced" technologies are not possible to use in this case (it's Intranet site) – Frankie Mar 11 '11 at 08:51
0

I have looked at a lot of places for a good example, and this is the one I like the best so far.

It does not handle the uploading, but it does a fine job at showing real progress to the user and it is not difficult to implement http://inov8.wordpress.com/2010/08/29/c-asp-net-creating-an-asynchronous-threaded-worker-process-manager-and-updatepanel-progress-monitor-control/

Pleun
  • 8,856
  • 2
  • 30
  • 50
  • @Furqan: the ideas and elements are available in the online resources, but also I found it difficult to find a complete example with source – Pleun Mar 10 '11 at 22:24
  • Yeah, this looks interesting and promising...I will definitely check it out...thanks! – Frankie Mar 11 '11 at 08:52